Skip to content

Commit

Permalink
Add test case for fzaninotto#538
Browse files Browse the repository at this point in the history
  • Loading branch information
schmengler committed Mar 19, 2015
1 parent 8cc3bd0 commit 377bbd6
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/Faker/GeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,21 @@ public function testMagicCallCallsFormatWithArguments()
$this->assertEquals('bazfoo', $generator->fooFormatterWithArguments('foo'));
}

public function testSeed()
{
$generator = new Generator;

$generator->seed(0);
$mtRandWithSeedZero = mt_rand();
$generator->seed(0);
$this->assertEquals($mtRandWithSeedZero, mt_rand(), 'seed(0) should be deterministic.');

$generator->seed();
$mtRandWithoutSeed = mt_rand();
$this->assertNotEquals($mtRandWithSeedZero, $mtRandWithoutSeed, 'seed() should be different than seed(0)');
$generator->seed();
$this->assertNotEquals($mtRandWithoutSeed, mt_rand(), 'seed() should not be deterministic.');
}
}

class FooProvider
Expand Down

0 comments on commit 377bbd6

Please sign in to comment.