Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
timacdonald committed Sep 10, 2024
1 parent fdb6492 commit d556b8a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/Feature/DatabaseDriverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1663,19 +1663,23 @@ public function testCanCheckAllAreActiveForScopeIncorrectScopeType(): void
$this->assertCount(2, DB::table('features')->get());
}

public function test_featuresNotBelongingToScope_someAreInactive_treatsScopesAsFalse(): void
public function testCanCheckSomeAreActiveForScopeIncorrectScopeTypeAndReturnsFalse(): void
{
Feature::define('team', fn (Team $team) => true);
Feature::define('user', fn (User $user) => true);
Feature::define('none', fn () => true);

$result = Feature::for(new User)->someAreInactive([
$active = Feature::for(new User)->active('user');
$someInactive = Feature::for(new User)->someAreInactive([
'team',
'user',
'none',
]);

$this->assertTrue($result);
$this->assertTrue($active);
$this->assertTrue($someInactive);
$this->assertCount(3, DB::getQueryLog());
$this->assertCount(1, DB::table('features')->get());
}

public function test_featuresNotBelongingToScope_allAreInactive_treatsScopesAsFalse(): void
Expand Down

0 comments on commit d556b8a

Please sign in to comment.