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:----LAaysxGONaDY4N4+R08fclDb/cbiSYeV8FGGLUmaGLaQooey/hpmWXErdQ/MZvrNSQ0mtBY0RrcCnHgftWUuVV/zip9IcZo0t/RRQvmCsBRvn/RAT5baYOrQ9zV0NzYsKV6pHq5QA519be8yS1ckSs8N1GQeuiIM7JYOXkI8TGs7YoJe2fWIm1XpSujcYGFzlH0T7a0VLcBJu8CKownkxfyWB26xRSU0vrvduX+VH9D7SbUm3kRu/qOYUN1Y3hR3rlemMITtQUPbv0sHtBCV5CiaaPj+7MnMiLLLJ8wMcaCmHFhUA2Fcdx0/+4pKkCMj7Qbv+Fx/XCsksJos9U5QG5yeynjIEaohOmz8T8WVsQqCFut9LvG58TTbXi1GOUCgXtwXsuAlk+AovzgDAaoRH3jbolELMwYpiVLmL+huZ8BN+zhLDoXiGsTI9Q50Ew/ZforFWyj1T6JxPt6qGikjpPf0LgNmm9j9G+ja6ui5ctMErJmhE4cPNdbAk+m4bMxmrhW74hJSBWWaNcycdiPB3moht3ySA7GJRaOl7obppo9vXCHWa9Mx7c92GGhUedqdUJqFEZE/aGe49sMDvEmm22zsZCxxm1LmlehetlGPk4I38pC7u1VuwGEigbfGPWZNY7gN3BpR/49kUFPOmEsQu/Z4fqokNiX+tEsvKz/AKgQ=----ATTACHMENT:----NTA1MTk1MDg5MjE0OTQ4NyAzMTkyNTUzOTUxNjg5NzI5IDQzMjU2MDA4NzA2NzU4NzU=