コード例 #1
0
ファイル: RunnerTest.php プロジェクト: hpbuniat/testy
 /**
  * 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());
     }
 }
コード例 #2
0
ファイル: Project.php プロジェクト: hpbuniat/testy
 /**
  * Run test and notify
  *
  * @return Project
  */
 public function run()
 {
     if (empty($this->_aFiles) === true) {
         return $this;
     }
     $this->notify(\notifyy\Notifyable::INFO, sprintf(self::INFO, implode(', ', $this->_aFiles)));
     $oSyntaxRunnner = new \Testy\Project\Test\Runner($this, $this->_aFiles, $this->_oConfig);
     if ($this->shouldSyntaxCheck() !== true or $this->lint($oSyntaxRunnner) === true) {
         $oRunner = new \Testy\Project\Test\Runner($this, $this->_aFiles, $this->_oConfig);
         try {
             try {
                 $this->notify(\notifyy\Notifyable::SUCCESS, $oRunner->run()->get());
             } catch (\Testy\Project\File\Exception $oException) {
                 $this->notify(\notifyy\Notifyable::INFO, $oException->getMessage());
             }
             if ($this->shouldRepeat() === true and $oRunner->executeSingle() === true) {
                 $this->notify(\notifyy\Notifyable::INFO, self::REPEAT);
                 $this->notify(\notifyy\Notifyable::SUCCESS, $oRunner->repeat()->run()->get());
             }
         } catch (\Testy\Project\Test\Exception $oException) {
             $this->notify(\notifyy\Notifyable::FAILED, $oException->getMessage());
         }
         unset($oRunner);
     }
     unset($oSyntaxRunnner);
     return $this;
 }