Skip to content

Commit e254517

Browse files
committed
Add test
1 parent 57539eb commit e254517

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/sharepoint/ListItemTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)