コード例 #1
0
 private function runNextTestOn(WorkerTestExecutor $worker)
 {
     if (count($this->tests) === 0) {
         $worker->stop();
         return null;
     }
     $test = $this->tests->dequeue();
     $this->listeners->testStarted($worker, $test);
     $worker->run($test);
 }
コード例 #2
0
 public function testProcessSendsUnexpectedResult()
 {
     $request1 = new TestRequest(1, 'foo', 'oo', 'footest.php');
     $request2 = new TestRequest(2, 'b', 'ar', 'bartest.php');
     $this->executor->run($request1);
     $this->executor->onTestResult(TestResult::errorFromRequest($request2, "Didn't bar!"));
     Phake::verify($this->distributor, Phake::atMost(1))->testCompleted($this->executor, Phake::capture($response));
     $this->assertEquals(2, $response->getId());
     $this->assertEquals("Didn't bar!", $response->getErrors()[0]->message);
     $this->assertEquals("An unexpected test was run, this could be a naming issue:\n" . "  Expected #1 - foo::footest.php\n" . "  Got #2 - b::bartest.php\n", $response->getErrors()[1]->message);
 }
コード例 #3
0
 public function testCompleted(WorkerTestExecutor $worker, TestResult $result)
 {
     $this->executedTests++;
     $message = '<good>✓</good>';
     foreach ($result->getErrors() as $error) {
         if ($error->severity == 'error') {
             $message = '<error>E</error>';
         } elseif ($error->severity == 'warning') {
             $message = '<warn>W</warn>';
         } else {
             $message = '<error>F</error>';
         }
     }
     $details = sprintf('%3d%%  %5dms  %5.1fMB  %s::%s', $this->executedTests / $this->expectedTests * 100, $result->getElapsed() * 1000, $result->getMemoryUsed() / 1024 / 1024, $result->getShortClassName(), $result->getName());
     $this->writeLanes($worker->getId(), $message, $details);
 }
コード例 #4
0
 public function testCompleted(WorkerTestExecutor $worker, TestResult $result)
 {
     $this->json["Worker{$worker->getId()}"][] = $result->toArray();
 }