Passed
Pull Request — master (#179)
by David
02:35
created

EmptyInnerResultIteratorTest::testOffsetUnset()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 3
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TheCodingMachine\TDBM;
4
5
use PHPUnit\Framework\TestCase;
6
7
class EmptyInnerResultIteratorTest extends TestCase
8
{
9
    public function testOffsetUnset()
10
    {
11
        $iterator = new EmptyInnerResultIterator();
12
        $this->expectException(TDBMInvalidOperationException::class);
13
        unset($iterator[42]);
14
    }
15
16
    public function testCount()
17
    {
18
        $iterator = new EmptyInnerResultIterator();
19
        $this->assertCount(0, $iterator);
20
    }
21
22
    public function testOffsetExists()
23
    {
24
        $iterator = new EmptyInnerResultIterator();
25
        $this->assertFalse(isset($iterator[0]));
26
    }
27
28
    public function testOffsetSet()
29
    {
30
        $iterator = new EmptyInnerResultIterator();
31
        $this->expectException(TDBMInvalidOperationException::class);
32
        $iterator[42] = 'foo';
33
    }
34
35
    public function testIterate()
36
    {
37
        $iterator = new EmptyInnerResultIterator();
38
        foreach ($iterator as $elem) {
39
            $this->fail('Iterator should be empty');
40
        }
41
        $this->assertTrue(true);
42
    }
43
44
    public function testOffsetGet()
45
    {
46
        $iterator = new EmptyInnerResultIterator();
47
        $this->expectException(TDBMInvalidOffsetException::class);
48
        $iterator[42];
49
    }
50
}
51