run() публичный Метод

public run ( Peridot\Core\TestResult $result )
$result Peridot\Core\TestResult
 /**
  * Read a suite path on the environment's read stream and execute
  * them against a standard Peridot runner.
  *
  * @param Context $context
  * @param Environment $environment
  * @param Message $message
  * @return void
  */
 public function loop(Context $context, Environment $environment, Message $message)
 {
     while (true) {
         $input = fgets($environment->getReadStream());
         list($token, $path) = $this->getTestInfo($input);
         $context->setFile($path);
         putenv("PERIDOT_TEST_TOKEN={$token}");
         require $path;
         $runner = new Runner($context->getCurrentSuite(), $environment->getConfiguration(), $environment->getEventEmitter());
         $runner->run(new TestResult($environment->getEventEmitter()));
         $message->end();
         $context->clear();
     }
 }
Пример #2
0
         });
         $passing2Child = new Test("passing2 child", function () {
         });
         $childSuite->addTest($passingChild);
         $childSuite->addTest($failingChild);
         $childSuite->addTest($passing2Child);
         $suite->addTest($childSuite);
         $passing2 = new Test("passing2 spec", function () {
         });
         $suite->addTest($passing2);
         $configuration = new Configuration();
         $configuration->stopOnFailure();
         $suite->setEventEmitter($this->eventEmitter);
         $runner = new Runner($suite, $configuration, $this->eventEmitter);
         $result = new TestResult($this->eventEmitter);
         $runner->run($result);
         assert($result->getTestCount() === 3, "spec count should be 3");
     });
 });
 $behavesLikeErrorEmitter = function () {
     $this->suite->addTest(new Test("my spec", function () {
         trigger_error("This is a user notice", E_USER_NOTICE);
     }));
     $error = [];
     $this->eventEmitter->on('error', function ($errno, $errstr, $errfile, $errline) use(&$error) {
         $error = array('errno' => $errno, 'errstr' => $errstr, 'errfile' => $errfile, 'errline' => $errline);
     });
     $this->runner->run(new TestResult(new EventEmitter()));
     assert($error['errno'] == E_USER_NOTICE, "error event should have passed error constant");
     assert($error['errstr'] == "This is a user notice");
 };