Completed
Branch feature/scrutinizer (5874ea)
by X
03:07
created

SourceTest::testConstructFailed()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace xKerman\Restricted\Test;
4
5
use PHPUnit\Framework\TestCase;
6
7
use xKerman\Restricted\Source;
8
9
/**
10
 * @coversDefaultClass \xKerman\Restricted\Source
11
 */
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