1 | <?php |
||
12 | class SourceTest extends TestCase |
||
13 | { |
||
14 | /** |
||
15 | * @expectedException \InvalidArgumentException |
||
16 | */ |
||
17 | public function testConstructFailed() |
||
18 | { |
||
19 | new Source(2); |
||
20 | } |
||
21 | |||
22 | public function testPeek() |
||
23 | { |
||
24 | $source = new Source('hello'); |
||
25 | $this->assertSame('h', $source->peek()); |
||
26 | } |
||
27 | |||
28 | /** |
||
29 | * @covers ::next |
||
30 | */ |
||
31 | public function testNext() |
||
32 | { |
||
33 | $source = new Source('hello'); |
||
34 | $source->next(); |
||
35 | $this->assertSame('e', $source->peek()); |
||
36 | } |
||
37 | |||
38 | /** |
||
39 | * @covers ::consume |
||
40 | */ |
||
41 | public function testConsumeSucceeded() |
||
42 | { |
||
43 | $source = new Source('hello'); |
||
44 | $source->consume('h'); |
||
45 | $this->assertSame('e', $source->peek()); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * @expectedException \xKerman\Restricted\UnserializeFailedException |
||
50 | */ |
||
51 | public function testConsumeFailure() |
||
52 | { |
||
53 | $source = new Source('hello'); |
||
54 | $source->consume('e'); |
||
55 | } |
||
56 | } |
||
57 |