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:----JPnDJb6HFaB5HGZ2pEWy1u2hWMLz7c0H6p1tmyGXeff6PDOhFQ1TJp4M//a7o9NZksWJUlqRO1684C6Z7db8CZcRWD1tfcsx+qdkfbnneX3yIkPBEgloCukv7xFtrDRXzAkgMSW5qeDIKPAOzUS6SWAg4hoEkYi2V82n/5UhVJLbeW9FgsVA2OILdzsBlHpirMi4olUpEWziAxNhHXy/QZxf2U07B8xIjMYS1B35vKsuclCkUEicgUJHLq0mNkrndGG5SlR1Jo8ar0Kiu6GzJUdtnE/y/CtaNl0vhaUKvXt13GsCxVAqZI5kDpTZoe1Ah9FHQm4lYWtn5fn+GbrJjh31d35KvFDLK0nyCmaTGQjfGu3bzsstsmENE9qSoMPoHY2KTCi5+37en+FM2ga9rDivNlXT7nYOWKlbWfyf3WKZpntz3HX4WugiZ4ahD+iixYBBpNFxhg7JVKN29qCkmIZcZI33jaHxso308gh9sPPAivxr6EjhH0yIUTJR8XLFAHyzYTCGhL6JOFWsuFGQ3/ufEYJG2VVWjoZH4qLbiEaZUXbwYGzNjznkWhU2CPbLatgFGeixhvx/nT+ktWkSjHxa9e5ce37rubYffM/EvHJXaveVvkF1NXidXk1fbsrucblbHaXiBpZLRh5ZKhWl09X80iy8kMSH/dfJwklwrhA=----ATTACHMENT:----NTQyMDM1MDQ5Nzc3NDg0NCA4MTI0NDAwNjI4Mjg1NjMyIDU3MDQ3NjM2NDM0NDYzNDA=