From 377bbd6076dedaa6e60d0cef1ddb6dea0f2e2cca Mon Sep 17 00:00:00 2001 From: Fabian Schmengler Date: Thu, 19 Mar 2015 08:48:58 +0100 Subject: [PATCH] Add test case for #538 --- test/Faker/GeneratorTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/Faker/GeneratorTest.php b/test/Faker/GeneratorTest.php index 147d9ddd18..9fea4f867a 100644 --- a/test/Faker/GeneratorTest.php +++ b/test/Faker/GeneratorTest.php @@ -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