Skip to content

Commit

Permalink
add new test case
Browse files Browse the repository at this point in the history
  • Loading branch information
recursivetree committed Nov 3, 2023
1 parent 1ea6b4d commit e59e95e
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
.env.php
.env
.idea/

# testing
vendor/
composer.lock
.phpunit.cache/test-results
40 changes: 40 additions & 0 deletions tests/Squads/AllianceRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,44 @@ public function testUserHasCharacterInAlliance()
$this->assertFalse($squad->isEligible($user));
}
}

/**
* This test checks whether a character from a corp outside an alliance is eligible for a squad with a alliance is not filter.
* In SeAT 4, this was not working properly
*/
public function testCharacterHasNoAllianceWithAllianceIsNotFilter(){
$squad = new Squad([
'name' => 'Testing Squad',
'description' => 'Some description',
'type' => 'auto',
'filters' => json_encode([
'and' => [
[
'name' => 'alliance',
'path' => 'characters.affiliation',
'field' => 'alliance_id',
'operator' => '<>',
'criteria' => 99000000,
'text' => 'Random Alliance',
],
],
]),
]);

$user = User::first();

$user->characters->each(function ($character){
$character->affiliation->update([
'alliance_id' => 99000000,
]);
});
$this->assertFalse($squad->isEligible($user));

$user->characters->each(function ($character){
$character->affiliation->update([
'alliance_id' => null,
]);
});
$this->assertTrue($squad->isEligible($user));
}
}

0 comments on commit e59e95e

Please sign in to comment.