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

SourceTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 45
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 45
rs 10
c 0
b 0
f 0
wmc 5
lcom 1
cbo 2

5 Methods

Rating   Name   Duplication   Size   Complexity  
A testConstructFailed() 0 4 1
A testPeek() 0 5 1
A testNext() 0 6 1
A testConsumeSucceeded() 0 6 1
A testConsumeFailure() 0 5 1
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