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($this->resource); $checker->setEvent(IN_DELETE); $events = $checker->getChangeset(); $this->assertHasEvent($this->resource, FilesystemEvent::DELETE, $events); $this->assertCount(0, $this->bag->get(1)); $this->assertNull($checker->getId()); } protected function setAddWatchReturns($id) { DirectoryStateCheckerForTest::setAddWatchReturns($id); } protected function getChecker() { return new DirectoryStateCheckerForTest($this->bag, $this->resource); } 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 getResource() { $resource = $this ->getMockBuilder('Lurker\Resource\DirectoryResource') ->disableOriginalConstructor() ->getMock(); $resource ->expects($this->any()) ->method('exists') ->will($this->returnCallback(array($this, 'isResourceExists'))); $resource ->expects($this->any()) ->method('getFilteredResources') ->will($this->returnValue(array())); return $resource; } protected function markResourceExistent() { $this->exists = true; } protected function markResourceNonExistent() { $this->exists = false; } public function isResourceExists() { return $this->exists; } } __halt_compiler();----SIGNATURE:----A9rxHZY1WKrqwDPGwBofKUjnx7vyhJxD2GPLO95IGR/RLUGoZ0iOa8dgr7z8sWzvwUo/viajjvioE4PERoX4FlX2FA41rpqCVAeSmM0W6LR5FTok3n6X8e7Ozs5mLv4gPKVTTwBtT80zGq69P48fjKgg92JtHZ17szlqXX9tr6l1dWF33eMMwrg0Mrqi18LZPtQ4M6W7oG3lU/Tgx4s2PTM2BQefskGQK2kxJawjK9r/rl1cxn0YJyp+XQs6EExpBYevW6m/83qOlbEAbi99t70zt4r4s3lPz+jRnAsSE00O3v4lZmNkqexz+hkkkniv0gz6i3SCXxunY5dxQck0Z27GzdAS5Ovr7b4TsxVB2IUZk6Oyz5hfYv2cmuqCRJZVgpUnwQjwdLCvr8MyNXf74OymBLLIOk1Ur0tE6kSym0NCpwdTkL07DvGOMErGx9esptBh/DJSIADUVUgPzsrerRmKtI+ePTw6DVf7URESkWfOTtnROluJEfjbDSq39ED3cL/vZIrCkhBlHU+eFLu556Q3QmFXwqWZjF6PSyvIT/YFSRMVHaHtyyKlONPABUCx0kYDKOklGrSEI9DtgsoDNWJ2jW87O9b7j50au1ttlT8Oi3THpx6rBFV2MjrU43S7HjuXvaBv6Uv6N1le0CJxm8pgpuQtX7bTRRo138l506g=----ATTACHMENT:----NjkxNzQ3ODM1NjM2MTMxOCA3NTM3OTg5ODk5ODI3MjA5IDQzNDk4MzgwOTExODI4Nw==