public function testPhpMdAvailability() { $this->assertTrue(self::$_cmd->canRun(), 'PHP Mess Detector command is not available.'); $minVersion = self::PHPMD_REQUIRED_VERSION; $version = self::$_cmd->getVersion(); $this->assertTrue(version_compare($version, $minVersion, '>='), "PHP Mess Detector minimal required version is '{$minVersion}'. The current version is '{$version}'."); }
/** * @dataProvider getVersionDataProvider */ public function testGetVersion($versionCmdOutput, $expectedVersion) { $cmdCallback = function ($shellCmd, array &$output = null) use($versionCmdOutput) { $output = array($versionCmdOutput); return !empty($shellCmd); }; $this->_cmd->expects($this->once())->method('_execShellCmd')->with($this->stringContains('phpmd'))->will($this->returnCallback($cmdCallback)); $this->assertEquals($expectedVersion, $this->_cmd->getVersion()); }
/** * @dataProvider getVersionDataProvider */ public function testGetVersion($versionCmdOutput, $expectedVersion) { $this->_cmd->expects($this->once())->method('_execShellCmd')->with($this->stringContains('phpmd'))->will($this->returnValue($versionCmdOutput)); $this->assertEquals($expectedVersion, $this->_cmd->getVersion()); }