app/Models/Card.php: in getBySettings() implement support to include X number of jackpot cards in the result.
This commit is contained in:
parent
0a80dbeb5e
commit
020645dbca
2 changed files with 37 additions and 6 deletions
|
|
@ -155,4 +155,22 @@ class CardTest extends TestCase
|
|||
$this->assertContains($card->role, $expected);
|
||||
}
|
||||
}
|
||||
|
||||
public function test_get_with_jackpot_cards()
|
||||
{
|
||||
Card::factory()->count(10)->create(['jackpot' => 1]);
|
||||
|
||||
$cards = Card::getBySettings(new GameSettings(), 4, 2);
|
||||
|
||||
$this->assertSame(4, count($cards));
|
||||
|
||||
$jackpot_count = 0;
|
||||
foreach ($cards as $card) {
|
||||
if ($card->jackpot != 0) {
|
||||
$jackpot_count++;
|
||||
}
|
||||
}
|
||||
|
||||
$this->assertEquals(2, $jackpot_count);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue