Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
AliceKLWilliams committed Mar 20, 2024
1 parent adf9eff commit 50fe7b0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
12 changes: 8 additions & 4 deletions tests/Unit/PostQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
15 changes: 10 additions & 5 deletions tests/Unit/ScopedQueryBuilderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit 50fe7b0

Please sign in to comment.