From 50fe7b0ed8392157b2489a571cdc6dbf7af2e386 Mon Sep 17 00:00:00 2001 From: Alice Williams <25745335+AliceKLWilliams@users.noreply.github.com> Date: Wed, 20 Mar 2024 16:25:45 +0000 Subject: [PATCH] Fix tests --- tests/Unit/PostQueryBuilderTest.php | 12 ++++++++---- tests/Unit/ScopedQueryBuilderTest.php | 15 ++++++++++----- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/tests/Unit/PostQueryBuilderTest.php b/tests/Unit/PostQueryBuilderTest.php index 46e2d68..c6e82f0 100644 --- a/tests/Unit/PostQueryBuilderTest.php +++ b/tests/Unit/PostQueryBuilderTest.php @@ -47,13 +47,17 @@ public function can_create_a_builder_from_static_functions() /** * @test - * @runInSeparateProcess */ public function throw_error_on_missing_static_function() { - $this->expectException(Throwable::class); - - Post::missingStaticFunction(); + $errorThrown = false; + try { + Post::missingStaticFunction(); + } catch (Throwable $th) { + $errorThrown = true; + } + + $this->assertTrue($errorThrown); } private function assertQueryBuilder($function, $params, $postType) diff --git a/tests/Unit/ScopedQueryBuilderTest.php b/tests/Unit/ScopedQueryBuilderTest.php index 012ce62..8103f65 100644 --- a/tests/Unit/ScopedQueryBuilderTest.php +++ b/tests/Unit/ScopedQueryBuilderTest.php @@ -4,6 +4,7 @@ use Illuminate\Support\Collection; use Mockery; +use PHPUnit\Framework\Exception; use PHPUnit\Framework\TestCase; use Rareloop\Lumberjack\Application; use Rareloop\Lumberjack\Contracts\QueryBuilder as QueryBuilderContract; @@ -111,14 +112,18 @@ public function can_pass_params_into_a_query_scope_on_post_object() /** * @test - * @runInSeparateProcess */ public function missing_query_scope_throws_an_error() { - $this->expectException(Throwable::class); - - $builder = new ScopedQueryBuilder(PostWithQueryScope::class); - $builder->nonExistentScope(); + $errorThrown = false; + try { + $builder = new ScopedQueryBuilder(PostWithQueryScope::class); + $builder->nonExistentScope(); + } catch (Throwable $th) { + $errorThrown = true; + } + + $this->assertTrue($errorThrown); } /** @test */