assertTrue($rule->validate($input)); } public function testInvalidExecutableFileShouldReturnFalse() { $GLOBALS['is_executable'] = false; $rule = new Executable(); $input = '/path/of/an/invalid/executable/file.txt'; $this->assertFalse($rule->validate($input)); } public function testShouldValidateObjects() { $rule = new Executable(); $object = $this->getMock('SplFileInfo', array('isExecutable'), array('somefile.txt')); $object->expects($this->once()) ->method('isExecutable') ->will($this->returnValue(true)); $this->assertTrue($rule->validate($object)); } }