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()
3838 foreach ($ iterator as $ elem ) {
3939 $ this ->fail ('Iterator should be empty ' );
4040 }
41- $ this ->assertTrue (true );
41+
42+ $ iterator ->next ();
43+ $ this ->assertNull ($ iterator ->current ());
44+ $ this ->assertNull ($ iterator ->key ());
4245 }
4346
4447 public function testOffsetGet ()
Original file line number Diff line number Diff line change 2121
2222namespace TheCodingMachine \TDBM ;
2323
24+ use ArrayIterator ;
25+ use IteratorAggregate ;
2426use PHPUnit \Framework \TestCase ;
2527
2628class MapIteratorTest extends TestCase
2729{
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+
2849 public function testConstructorException1 (): void
2950 {
3051 $ this ->expectException ('TheCodingMachine\TDBM\TDBMException ' );
You can’t perform that action at this time.
0 commit comments