-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathEmptyInnerResultIteratorTest.php
53 lines (44 loc) · 1.31 KB
/
EmptyInnerResultIteratorTest.php
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
<?php
namespace TheCodingMachine\TDBM;
use PHPUnit\Framework\TestCase;
class EmptyInnerResultIteratorTest extends TestCase
{
public function testOffsetUnset()
{
$iterator = new EmptyInnerResultIterator();
$this->expectException(TDBMInvalidOperationException::class);
unset($iterator[42]);
}
public function testCount()
{
$iterator = new EmptyInnerResultIterator();
$this->assertCount(0, $iterator);
}
public function testOffsetExists()
{
$iterator = new EmptyInnerResultIterator();
$this->assertFalse(isset($iterator[0]));
}
public function testOffsetSet()
{
$iterator = new EmptyInnerResultIterator();
$this->expectException(TDBMInvalidOperationException::class);
$iterator[42] = 'foo';
}
public function testIterate()
{
$iterator = new EmptyInnerResultIterator();
foreach ($iterator as $elem) {
$this->fail('Iterator should be empty');
}
$iterator->next();
$this->assertNull($iterator->current());
$this->assertNull($iterator->key());
}
public function testOffsetGet()
{
$iterator = new EmptyInnerResultIterator();
$this->expectException(TDBMInvalidOffsetException::class);
$iterator[42];
}
}