Exemplo n.º 1
0
 public function testCanRunJsFileDoesNotExistException()
 {
     $this->_cmd->expects($this->any())->method('_getHostScript')->will($this->returnValue('cscript'));
     $this->_cmd->expects($this->any())->method('_executeCommand')->with($this->stringContains('cscript'))->will($this->returnValue(['output', 0]));
     $this->_cmd->expects($this->any())->method('_getJsHintPath')->will($this->returnValue('jshint-path'));
     $this->_cmd->expects($this->any())->method('_fileExists')->will($this->returnCallback(function () {
         $arg = func_get_arg(0);
         if ($arg == 'jshint-path') {
             return true;
         }
         if ($arg == 'mage.js') {
             return false;
         }
     }));
     $this->_cmd->expects($this->any())->method('getFileName')->will($this->returnValue('mage.js'));
     try {
         $this->_cmd->canRun();
     } catch (\Exception $e) {
         $this->assertEquals('mage.js does not exist.', $e->getMessage());
     }
 }
Exemplo n.º 2
0
 /**
  * @dataProvider canTestDataProvider
  */
 public function testCanRun($cmdOutput, $expectedResult)
 {
     $this->_cmd->expects($this->once())->method('_execShellCmd')->with($this->stringContains('phpmd'))->will($this->returnValue($cmdOutput));
     $this->assertEquals($expectedResult, $this->_cmd->canRun());
 }