Ejemplo n.º 1
0
 public function testStoppedNotice()
 {
     $e = new RunEvent();
     $tests = array();
     $test = null;
     $results = new Collection();
     for ($x = 0; $x < 15; $x++) {
         $tests[] = $test = new AlwaysSuccessTest();
         $results[$test] = new Success();
     }
     $e->setParam('tests', $tests);
     $e->setResults($results);
     ob_start();
     $this->em->trigger(RunEvent::EVENT_START, $e);
     ob_clean();
     $this->em->trigger(RunEvent::EVENT_STOP, $e);
     $this->em->trigger(RunEvent::EVENT_FINISH, $e);
     $this->assertStringMatchesFormat('%ADiagnostics aborted%A', trim(ob_get_clean()));
 }
Ejemplo n.º 2
0
 public function testCatchErrors()
 {
     \PHPUnit_Framework_Error_Warning::$enabled = false;
     \PHPUnit_Framework_Error_Notice::$enabled = false;
     $e = new RunEvent();
     $this->listener->setCatchErrorSeverity(E_WARNING);
     $test = new TriggerWarningTest();
     $e->setTarget($test);
     $result = $this->em->trigger(RunEvent::EVENT_RUN, $e)->last();
     $this->assertInstanceOf('ZFTool\\Diagnostics\\Result\\Failure', $result);
     $this->assertInstanceOf('ErrorException', $result->getData());
     $e = new RunEvent();
     $this->listener->setCatchErrorSeverity(E_WARNING | E_USER_ERROR);
     $test = new TriggerUserErrorTest('bar', E_USER_ERROR);
     $e->setTarget($test);
     $result = $this->em->trigger(RunEvent::EVENT_RUN, $e)->last();
     $this->assertInstanceOf('ZFTool\\Diagnostics\\Result\\Failure', $result);
     $this->assertStringStartsWith('PHP USER_ERROR: bar', $result->getMessage());
     $this->assertInstanceOf('ErrorException', $result->getData());
 }