File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -369,8 +369,8 @@ public function getIterator(): Traversable
369369 }
370370
371371 if ($ this ->pagedMode ){
372- $ nextItems = $ this ->getNext ()->executeQuery ();
373372 if ($ this ->hasNext ()){
373+ $ nextItems = $ this ->getNext ()->executeQuery ();
374374 foreach ($ nextItems as $ item ){
375375 yield $ item ;
376376 }
Original file line number Diff line number Diff line change @@ -38,6 +38,23 @@ public function testItemsCount()
3838 $ this ->assertEquals ($ itemsCount , $ items ->getCount ());
3939 }
4040
41+ public function testIterator ()
42+ {
43+ // Test that list items can be iterated over without crashing
44+ // First, test a simple get with no paging
45+ foreach (self ::$ targetList ->getItems ()->get ()->executeQuery () as $ item ) {
46+ $ this ->assertNotEmpty ($ item );
47+ }
48+ // Now test with explicit paging
49+ foreach (self ::$ targetList ->getItems ()->get ()->paged (1 )->executeQuery () as $ item ) {
50+ $ this ->assertNotEmpty ($ item );
51+ }
52+ // Now test with implicit paging via getAll()
53+ foreach (self ::$ targetList ->getItems ()->getAll ()->executeQuery () as $ item ) {
54+ $ this ->assertNotEmpty ($ item );
55+ }
56+ }
57+
4158
4259 public function testCreateFolderInList (){
4360 //ensure Folder creation is enabled for a List
You can’t perform that action at this time.
0 commit comments