mirror of
https://github.com/nothingworksinc/ticketbeast.git
synced 2026-01-31 04:46:37 +00:00
81 - Ensuring Uniqueness
This commit is contained in:
@@ -47,4 +47,16 @@ class RandomOrderConfirmationNumberGeneratorTest extends TestCase
|
||||
$this->assertFalse(strpos($confirmationNumber, '0'));
|
||||
$this->assertFalse(strpos($confirmationNumber, 'O'));
|
||||
}
|
||||
|
||||
/** @test */
|
||||
function confirmation_numbers_must_be_unique()
|
||||
{
|
||||
$generator = new RandomOrderConfirmationNumberGenerator;
|
||||
|
||||
$confirmationNumbers = array_map(function ($i) use ($generator) {
|
||||
return $generator->generate();
|
||||
}, range(1, 100));
|
||||
|
||||
$this->assertCount(100, array_unique($confirmationNumbers));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user