assertTrue($rule->validate($input)); } /** * @covers Respect\Validation\Rules\File::validate */ public function testInvalidFileShouldReturnFalse() { $GLOBALS['is_file'] = false; $rule = new File(); $input = '/path/of/an/invalid/file.txt'; $this->assertFalse($rule->validate($input)); } /** * @covers Respect\Validation\Rules\File::validate */ public function testShouldValidateObjects() { $rule = new File(); $object = $this->getMock('SplFileInfo', array('isFile'), array('somefile.txt')); $object->expects($this->once()) ->method('isFile') ->will($this->returnValue(true)); $this->assertTrue($rule->validate($object)); } }