示例#1
0
 public function testCanRun()
 {
     $result = false;
     try {
         $result = self::$_cmd->canRun();
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
     $this->assertTrue($result, true);
 }
示例#2
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(array('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());
     }
 }
示例#3
0
 /**
  * @dataProvider codeJsHintDataProvider
  */
 public function testCodeJsHint($filename)
 {
     $cmd = new Inspection_JsHint_Command($filename, self::$_reportFile);
     $result = false;
     try {
         $result = $cmd->canRun();
     } catch (Exception $e) {
         $this->markTestSkipped($e->getMessage());
     }
     if ($result) {
         $this->assertTrue($cmd->run(array()), $cmd->getLastRunMessage());
     }
 }