File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,10 @@ public function testIterate()
38
38
foreach ($ iterator as $ elem ) {
39
39
$ this ->fail ('Iterator should be empty ' );
40
40
}
41
- $ this ->assertTrue (true );
41
+
42
+ $ iterator ->next ();
43
+ $ this ->assertNull ($ iterator ->current ());
44
+ $ this ->assertNull ($ iterator ->key ());
42
45
}
43
46
44
47
public function testOffsetGet ()
Original file line number Diff line number Diff line change 21
21
22
22
namespace TheCodingMachine \TDBM ;
23
23
24
+ use ArrayIterator ;
25
+ use IteratorAggregate ;
24
26
use PHPUnit \Framework \TestCase ;
25
27
26
28
class MapIteratorTest extends TestCase
27
29
{
30
+ public function testIteratorAggregate (): void
31
+ {
32
+ $ mapIterator = new MapIterator (new class implements IteratorAggregate
33
+ {
34
+ public $ property1 = "Public property one " ;
35
+ public $ property2 = "Public property two " ;
36
+ public $ property3 = "Public property three " ;
37
+
38
+ public function getIterator ()
39
+ {
40
+ return new ArrayIterator ($ this );
41
+ }
42
+ }, function ($ item ) {
43
+ return $ item ;
44
+ });
45
+
46
+ self ::assertCount (3 , $ mapIterator );
47
+ }
48
+
28
49
public function testConstructorException1 (): void
29
50
{
30
51
$ this ->expectException ('TheCodingMachine\TDBM\TDBMException ' );
You can’t perform that action at this time.
0 commit comments