markTestSkipped('Inotify is required for this test'); } $this->bag = new CheckerBag('whatever'); $this->resource = $this->getResource(); } public function testResourceAddedToBag() { $this->setAddWatchReturns(1); $checker = $this->getChecker(); $this->assertCount(1, $this->bag->get(1)); $this->assertContains($checker, $this->bag->get(1)); } public function testResourceDeleted() { $this->setAddWatchReturns(1); $this->markResourceNonExistent(); $checker = $this->getChecker(); $checker->setEvent(IN_IGNORED); $events = $checker->getChangeset(); $this->assertHasEvent($this->resource, FilesystemEvent::DELETE, $events); $this->assertCount(0, $this->bag->get(1)); $this->assertNull($checker->getId()); } public function testResourceCreated() { $this->setAddWatchReturns(1); $this->markResourceNonExistent(); $checker = $this->getChecker(); $checker->setEvent(IN_IGNORED); $checker->getChangeset(); $this->setAddWatchReturns(2); $this->markResourceExistent(); $events = $checker->getChangeset(); $this->assertHasEvent($this->resource, FilesystemEvent::CREATE, $events); $this->assertCount(1, $this->bag->get(2)); $this->assertContains($checker, $this->bag->get(2)); } public function testResourceMoved() { $this->setAddWatchReturns(1); $this->markResourceNonExistent(); $checker = $this->getChecker(); $checker->setEvent(IN_MOVE_SELF); $events = $checker->getChangeset(); $this->assertHasEvent($this->resource, FilesystemEvent::DELETE, $events); $this->assertCount(0, $this->bag->get(1)); $this->assertNull($checker->getId()); $this->setAddWatchReturns(2); $this->markResourceExistent(); $events = $checker->getChangeset(); $this->assertHasEvent($this->resource, FilesystemEvent::CREATE, $events); $this->assertCount(1, $this->bag->get(2)); $this->assertContains($checker, $this->bag->get(2)); } public function testResourceMovedAndReturnedSameWatchId() { $this->setAddWatchReturns(1); $checker = $this->getChecker(); $checker->setEvent(IN_MOVE_SELF); $events = $checker->getChangeset(); $this->assertEmpty($events); } public function isResourceExists() { return $this->exists; } protected function assertHasEvent(ResourceInterface $resource, $event, $events) { $this->assertContains(array('resource' => $resource, 'event' => $event), $events, sprintf('Cannot find the expected event for the received resource')); } protected function markResourceExistent() { $this->exists = true; } protected function markResourceNonExistent() { $this->exists = false; } abstract protected function setAddWatchReturns($id); abstract protected function getChecker(); abstract protected function getResource(); } __halt_compiler();----SIGNATURE:----xDjxfCxpvT/zjKAEETJxMzugID7JGq7JyAXj70aaJrTgQ6wjI8amBuyHRov2eGoQTCNmX6tU+2g3sykZfRJxVDHjR3Ag0HywAcZkbbYP8G4Q38M8d0Ql2iT2THN2YEJheoll6MGtkeUIMSRbRJz2516LkNB/3SyR/oU+K6aP0enlbKXV+sbd6QifjhsMDrfFoM6Hgy3yuVOGKWLv9YADJVAc5sf0+EYS5hYxkDQGPYtwPzQ96aCgVFkCXnmksoqu4/0A7FwG9yB9/eOK/mp7MZkKHqU6h0icPP8YvXVRHfxnt1ecqdW29h9LwfzcILdGVJKwX5TILr7/PFSDX/klM+HmgcWtfjefy3H65+LfwfyF4AZrJAf13oSxc58mrh0w39S4fZ7db3DKrhIPlsA7J4PQxKNzK2jjDRQpPXDd2RMmcGdMNNJnvQQBRbUV9A4i5GpLFi4+699g/hoeYZOTuRrk37in/X43TjK5ODPeMq9V7YgvYOzbXc4Og+GscIHDsY72shZdjjAWMyuze652WYXoY8FJJO/FblhvwJkFaFagSqPew9Tqbpy2owjWllpOubRW95iFOtCnQGtLtBNbEUve1avahhVTbiz4YRUxg+dLLzwUamuxXa2yTUTVB2dyZtb+ykM2ncEqZ4YbqtvPLgBAa5W5P11JVH6YIH43K+A=----ATTACHMENT:----MTk4MDk2MTczNTQ3ODQwNiAyNDAzNTIxMzA3NTI1MjUxIDc2MTM4ODc2NTQyNTQwNDg=