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