createResource(); $checker = $this->createChecker($resource); $this->assertSame($resource, $checker->getResource()); } public function testNoChanges() { $resource = $this->createResource(true); $checker = $this->createChecker($resource); $resource ->expects($this->once()) ->method('isFresh') ->with(12) ->will($this->returnValue(true)); $this->assertEquals(array(), $checker->getChangeset()); } public function testDeleted() { $resource = $this->createResource(null); $resource ->expects($this->any()) ->method('exists') ->will($this->onConsecutiveCalls(true, false)); $checker = $this->createChecker($resource); $this->assertEquals( array(array('event' => FilesystemEvent::DELETE, 'resource' => $resource)), $checker->getChangeset() ); } public function testModified() { $resource = $this->createResource(true); $checker = $this->createChecker($resource); $resource ->expects($this->once()) ->method('isFresh') ->with(12) ->will($this->returnValue(false)); $this->assertEquals( array(array('event' => FilesystemEvent::MODIFY, 'resource' => $resource)), $checker->getChangeset() ); } public function testConsecutiveChecks() { $resource = $this->createResource(null); $resource ->expects($this->any()) ->method('exists') ->will($this->onConsecutiveCalls(true, true, false)); $checker = $this->createChecker($resource); $resource ->expects($this->once()) ->method('isFresh') ->with(12) ->will($this->returnValue(false)); $this->assertEquals( array(array('event' => FilesystemEvent::MODIFY, 'resource' => $resource)), $checker->getChangeset() ); $this->assertEquals( array(array('event' => FilesystemEvent::DELETE, 'resource' => $resource)), $checker->getChangeset() ); $this->assertEquals(array(), $checker->getChangeset()); } protected function createResource($exists = true) { $resource = $this ->getMockBuilder('Lurker\Resource\FileResource') ->disableOriginalConstructor() ->getMock(); $resource ->expects($this->any()) ->method('getModificationTime') ->will($this->returnValue(11)); if (null !== $exists) { $resource ->expects($this->any()) ->method('exists') ->will($this->returnValue($exists)); } return $resource; } protected function createChecker($resource) { return new FileStateChecker($resource); } } __halt_compiler();----SIGNATURE:----N0d1Yt9ClMkB7MPvblCKloRQycMkCd42FuZJgieQHu6uo/wQwsgwQRT+SfSMFePL/HroOCK/pkoXgbVNff+YTFIohiECFScKpiHrNkPVMoHFmsJaMGr/G1HldObdsrUTn21SgsYTIYQTAJtIkrJzk68XWSVh09YAe80ZnzfhXiP1sl6YNj4cai1SQJe/79ZRKcgdNq2vqejmRwyoQLhGlZ0yDrEHCcswXvPGxvhqAaSXcEDnyMMr6cRhfKAqpa96Ltq/TMRqcCwr9g/kH8rWOP/megZ5U9aLp14vjCetstImOE5F6c9HOoj+tdyNzv12hRrH3RNxXs42znkL2Ad6gUIV2stFAlDxarJkZP0qMlkbRoHCBvJEr1Nv99eQB5HRMWU94zeonmypawW95n0mxPfSyc+8oA3AkMWZ2A7HmpUZQmvQGpydw9sVy5FAQHEkwlB6wm2ggm2oaGaz4fS2rTOWE0olxVbIwnttWEgS8so4S0K1efp4fSroglNgqzqPTVjhSV47JWUuQYDJc4RAa77l8TOaBjRdpZzCDJjmJh0P9D4N0M41m9J8qkvFjId4IL0JH/wcuLcbwjO3v9PQIx0H2uybonDbNnVGqTKTogKwkBWxkxLl+hGaBXoKw+HoRwj2YADGMC16nylE4KscP7NpX7trtS4r6GZ+pLa3GrE=----ATTACHMENT:----NTAyNzU4NTkzNDY4MzUxNSA0OTY2MTYwODY2NjEyMDU3IDg4MjE5OTY4MzIxODM5ODA=