Skip to content

Commit 45f4602

Browse files
committed
due to race condition, I do not test Folder::next should return null
1 parent 91ab626 commit 45f4602

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/DropboxHelperTest.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,6 @@ public function testListFolderFromCursor()
198198

199199
$oFolder = $this->dropboxHelper->loadFolderCursor($sCursor);
200200

201-
# This is the last cursor so Folder::next should return null
202-
$this->assertNull($oFolder->next());
203-
204201
# Test Folder::next after write
205202
$sTestFilePath = $this->sFolderPath . '/DropboxHelper-test-file-' . uniqid() . '.txt';
206203
$sContent = "PHP Unit Test of DropboxHelper:\n" . (new \DateTime())->format(DATE_ATOM);
@@ -209,11 +206,21 @@ public function testListFolderFromCursor()
209206
$oFolder = $this->dropboxHelper->loadFolderCursor($sCursor);
210207
$this->assertInternalType('array', $oFolder->next());
211208

209+
# Race condition: there may be other items to test
210+
while (($aFolder = $oFolder->next())) {
211+
$this->assertInternalType('array', $aFolder);
212+
}
213+
212214
# Test Folder::next after delete
213215
$bResult = $this->dropboxHelper->delete($sTestFilePath);
214216

215217
$oFolder = $this->dropboxHelper->loadFolderCursor($sCursor);
216218
$this->assertInternalType('array', $oFolder->next());
219+
220+
# Race condition: there may be other items to test
221+
while (($aFolder = $oFolder->next())) {
222+
$this->assertInternalType('array', $aFolder);
223+
}
217224
}
218225

219226
public function testFolder()

0 commit comments

Comments
 (0)