diff --git a/lib/DAV/PropPatch.php b/lib/DAV/PropPatch.php index 092909dea8..71187b02e1 100644 --- a/lib/DAV/PropPatch.php +++ b/lib/DAV/PropPatch.php @@ -123,12 +123,12 @@ public function handleRemaining(callable $callback) foreach ($properties as $propertyName) { // HTTP Accepted $this->result[$propertyName] = 202; - - $this->propertyUpdateCallbacks[] = [ - $properties, - $callback, - ]; } + + $this->propertyUpdateCallbacks[] = [ + $properties, + $callback, + ]; } /** diff --git a/tests/Sabre/DAV/PropPatchTest.php b/tests/Sabre/DAV/PropPatchTest.php index 2f71dc357e..1ae9545eea 100644 --- a/tests/Sabre/DAV/PropPatchTest.php +++ b/tests/Sabre/DAV/PropPatchTest.php @@ -121,6 +121,32 @@ public function testHandleRemaining() self::assertTrue($hasRan); } + public function testHandleMultipleRemaining() + { + $cunCounter = 0; + + $this->propPatch = new PropPatch([ + '{DAV:}displayname' => 'foo', + 'unittest' => 'bar', + ]); + + $this->propPatch->handleRemaining(function ($mutations) use (&$cunCounter) { + ++$cunCounter; + self::assertCount(2, $mutations); + + return true; + }); + + self::assertTrue($this->propPatch->commit()); + $result = $this->propPatch->getResult(); + self::assertEquals([ + '{DAV:}displayname' => 200, + 'unittest' => 200, + ], $result); + + self::assertSame(1, $cunCounter); + } + public function testHandleRemainingNothingToDo() { $hasRan = false;