Skip to content

Commit

Permalink
added prop patch handle multiple remaining test
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmhh committed Sep 6, 2024
1 parent 7a736b7 commit 5c928dd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions tests/Sabre/DAV/PropPatchTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,36 @@ public function testHandleRemaining()
self::assertTrue($hasRan);
}

public function testHandleMultipleRemaining()
{
$hasRan = false;

$this->propPatch = new PropPatch([
'{DAV:}displayname' => 'foo',
'unittest' => 'bar',
]);

$this->propPatch->handleRemaining(function ($mutations) use (&$hasRan) {
static $numberOfCalls = 0;

self::assertCount(2, $mutations);
self::assertLessThan(2, ++$numberOfCalls);

$hasRan = true;

return true;
});

self::assertTrue($this->propPatch->commit());
$result = $this->propPatch->getResult();
self::assertEquals([
'{DAV:}displayname' => 200,
'unittest' => 200,
], $result);

self::assertTrue($hasRan);
}

public function testHandleRemainingNothingToDo()
{
$hasRan = false;
Expand Down

0 comments on commit 5c928dd

Please sign in to comment.