diff options
author | marvin-borner@live.com | 2018-04-10 21:50:16 +0200 |
---|---|---|
committer | marvin-borner@live.com | 2018-04-10 21:54:48 +0200 |
commit | fc9401f04a3aca5abb22f87ebc210de8afe11d32 (patch) | |
tree | b0b310f3581764ec3955f4e496a05137a32951c3 /assets/php/vendor/nubs/random-name-generator/tests/AlliterationTest.php | |
parent | 286d643180672f20526f3dc3bd19d7b751e2fa97 (diff) |
Initial Commit
Diffstat (limited to 'assets/php/vendor/nubs/random-name-generator/tests/AlliterationTest.php')
-rw-r--r-- | assets/php/vendor/nubs/random-name-generator/tests/AlliterationTest.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/assets/php/vendor/nubs/random-name-generator/tests/AlliterationTest.php b/assets/php/vendor/nubs/random-name-generator/tests/AlliterationTest.php new file mode 100644 index 0000000..0b47343 --- /dev/null +++ b/assets/php/vendor/nubs/random-name-generator/tests/AlliterationTest.php @@ -0,0 +1,66 @@ +<?php +namespace Nubs\RandomNameGenerator; + +use PHPUnit_Framework_TestCase; +use Cinam\Randomizer\Randomizer; + +/** + * @coversDefaultClass \Nubs\RandomNameGenerator\Alliteration + * @covers ::<protected> + */ +class AlliterationTest extends PHPUnit_Framework_TestCase +{ + /** + * Verify basic behavior of getName(). + * + * @test + * @covers ::__construct + * @covers ::getName + * + * @return void + */ + public function getNameBasic() + { + $generator = new Alliteration(); + $parts = explode(' ', $generator->getName()); + $this->assertSame(2, count($parts)); + $this->assertSame($parts[0][0], $parts[1][0]); + } + + /** + * Verify basic behavior of getName() with a forced random generator. + * + * @test + * @covers ::__construct + * @covers ::getName + * + * @return void + */ + public function getNameForced() + { + $numberGenerator = $this->createMock('\Cinam\Randomizer\NumberGenerator'); + $numberGenerator->expects($this->exactly(2))->method('getInt')->will($this->onConsecutiveCalls(20, 5)); + $randomizer = new Randomizer($numberGenerator); + + $generator = new Alliteration($randomizer); + $this->assertSame('Black Bear', $generator->getName()); + } + + /** + * Verify basic behavior of __toString(). + * + * @test + * @covers ::__construct + * @covers ::__toString + * @covers ::getName + * + * @return void + */ + public function toStringBasic() + { + $generator = new Alliteration(); + $parts = explode(' ', (string)$generator); + $this->assertSame(2, count($parts)); + $this->assertSame($parts[0][0], $parts[1][0]); + } +} |