Esempio n. 1
0
 /**
  * Test the lint-command
  *
  * @dataProvider lintProvider
  */
 public function testLint($bExpected, $sCommand = 'Success')
 {
     $this->_oConfig->syntax = 'test';
     $this->assertInstanceOf('\\Testy\\Project', $this->_object->config($this->_oConfig));
     $this->assertTrue($this->_object->shouldSyntaxCheck());
     $sCommand = 'get' . ucfirst($sCommand);
     $this->assertInstanceOf('\\Testy\\Project', $this->_object->setCommand(\Testy\Test\Helper\Command::$sCommand()));
     $oRunner = new \Testy\Project\Test\Runner($this->_object, array(__FILE__), $this->_oConfig);
     $this->assertEquals($bExpected, $this->_object->lint($oRunner));
     unset($oRunner, $sCommand);
 }
Esempio n. 2
0
 /**
  * Test the result, if a command does not succeed
  */
 public function testCommandFailure()
 {
     $aFiles = array(__FILE__);
     try {
         $this->assertInstanceOf('\\Testy\\Project', $this->_oProject->setCommand(\Testy\Test\Helper\Command::getFailure()));
         $oRunner = new \Testy\Project\Test\Runner($this->_oProject, $aFiles, $this->_oConfig);
         $oRunner->setCommand('./' . uniqid())->run();
         $this->fail('An exception should have been thrown');
     } catch (\Testy\Project\Test\Exception $e) {
         $this->assertEquals('', $e->getMessage());
     }
 }
Esempio n. 3
0
 /**
  * Add a project to watch
  *
  * @param  \Testy\Project $oProject
  *
  * @return $this
  */
 public function add(\Testy\Project $oProject)
 {
     $sName = $oProject->getName();
     if (empty($this->_aStack[$sName]) === true or $oProject->getProjectHash() !== $this->_aStack[$sName]->getProjectHash()) {
         if ($oProject->isEnabled() === true) {
             $this->_aStack[$sName] = $oProject;
             $oProject->notify(\notifyy\Notifyable::INFO, \Testy\Project\Builder::INFO);
         } elseif (empty($this->_aStack[$sName]) !== true) {
             unset($this->_aStack[$sName]);
         }
     }
     return $this;
 }
Esempio n. 4
0
 /**
  * Execute a command
  *
  * @param  string $sCommand
  *
  * @return boolean
  *
  * @throws \Testy\Project\Test\Exception If the test fails
  */
 protected function _execute($sCommand)
 {
     $this->_iCommands++;
     $this->_sLastCommand = $sCommand;
     $oCommand = $this->_oProject->getCommand();
     $this->_sReturn = $oCommand->setCommand($this->_sLastCommand)->execute()->get();
     if ($oCommand->isSuccess() !== true) {
         throw new \Testy\Project\Test\Exception($this->_sReturn);
     }
     return $oCommand->isSuccess();
 }