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:----lRHCBBdDpvK6tLQqRxtjHXkqYoF9N5EdSi8RkvGVKaTPIzeeqZy7OgHBVtdLKBdrMUgrbX/nf39WaLwwDQsAlPzwpd0+RtEqW72rQlEEaR332VcAeRZMalEtJfwL2KxgjMEJKX+378wHOf2l+OQHbWNecyTsmcOgB12/IDKIGXkvWtwxGulLXcCAhHtfs/TybQWPvUKvRaVGZD3lgdYj3jrYz62DcQHGlWdJF3XTaOTNjUEoddm1A3TpbJ5rCDdIESoYuMOd7yA9zjQlurUu1onAojAknPNSy6YYEXdQW/f6PKeN3ZTMYpDScVyqy+Au+vtcQKL2smenBce5I2thY5BRswg/dD9PoXV1MZR6w/XnHde3+VdwKY+kAQQllcpG6JHrn9TnaomRw8g7dyRdGBEDwgJaE96F8Avm7tShTShIAXbVSYzl5eF4BCRpiXw2gqCcOL6MkH8X0lBcARKfEK9r1FV9U1W64vdubADdnsxHpf3o+ABk1maM/uj7hGDIMJu+tnDyEFjX4Y58WvpTSpbpKQDTAT4vviVX9YwyIMTtKeb3h+TduM3wndGbjTASVoKEMdh7iNkf2iVXvFpQEuiIb46uXLuoK+de3qDabpkCWwwJDao821MpBXHJJS39bEvNsbpNWJO0B9nGL98pphC7elg1rnhnzLjXr27M0A4=----ATTACHMENT:----NDgzNzg1Mjc3OTgzMjk2NCA5NDIxOTk4MzMzNDMzNTU1IDE1MTM5Njc2NDkzMDM2NzI=