blob: a301b81298b81fa4c7cfb9823445278b1abc24b9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php
namespace Nubs\RandomNameGenerator;
use PHPUnit_Framework_TestCase;
use Cinam\Randomizer\Randomizer;
/**
* @coversDefaultClass \Nubs\RandomNameGenerator\Vgng
* @covers ::<protected>
*/
class VgngTest extends PHPUnit_Framework_TestCase
{
/**
* Verify that getName returns the expected name.
*
* @test
* @covers ::__construct
* @covers ::getName
*/
public function getNameBasic()
{
$numberGenerator = $this->createMock('\Cinam\Randomizer\NumberGenerator');
$numberGenerator->expects($this->exactly(3))->method('getInt')->will($this->returnValue(1));
$randomizer = new Randomizer($numberGenerator);
$vgng = new Vgng($randomizer);
$this->assertSame('8-Bit Acid - 3rd Strike', $vgng->getName());
}
/**
* Verify that getName returns a name without similar strings.
*
* @test
* @covers ::__construct
* @covers ::getName
*/
public function getNameSimilarName()
{
$numberGenerator = $this->createMock('\Cinam\Randomizer\NumberGenerator');
$numberGenerator->expects($this->exactly(4))->method('getInt')->will($this->onConsecutiveCalls(0, 0, 2, 10));
$randomizer = new Randomizer($numberGenerator);
$vgng = new Vgng($randomizer);
$this->assertSame('3D Aerobics Academy', $vgng->getName());
}
/**
* Verify that toString returns the expected name.
*
* @test
* @covers ::__construct
* @covers ::__toString
* @covers ::getName
*/
public function toStringBasic()
{
$numberGenerator = $this->createMock('\Cinam\Randomizer\NumberGenerator');
$numberGenerator->expects($this->exactly(3))->method('getInt')->will($this->returnValue(1));
$randomizer = new Randomizer($numberGenerator);
$vgng = new Vgng($randomizer);
$this->assertSame('8-Bit Acid - 3rd Strike', (string)$vgng);
}
}
|