Example #1
0
 public function test__toString()
 {
     $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getExceptions = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($field = new runner\exceptions\cli())->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEmpty()->if($score->getMockController()->getExceptions = $exceptions = array(array('class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = uniqid(), 'value' => $value = uniqid()), array('class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = uniqid(), 'value' => ($firstOtherValue = uniqid()) . PHP_EOL . ($secondOtherValue = uniqid()))))->and($field = new runner\exceptions\cli())->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEqualTo(sprintf('There are %d exceptions:', sizeof($exceptions)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Exception throwed in file %s on line %d:', $file, $line) . PHP_EOL . $value . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('Exception throwed in file %s on line %d:', $otherFile, $otherLine) . PHP_EOL . $firstOtherValue . PHP_EOL . $secondOtherValue . PHP_EOL)->if($field = new runner\exceptions\cli())->and($field->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($field->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($field->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($field->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($field->setExceptionPrompt($exceptionPrompt = new prompt(uniqid())))->and($field->setExceptionColorizer($exceptionColorizer = new colorizer(uniqid(), uniqid())))->and($field->setLocale($locale = new locale()))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($field->getLocale()->__('There is %d exception', 'There are %d exceptions', sizeof($exceptions)), sizeof($exceptions)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $exceptionPrompt . sprintf($locale->_('%s:'), $exceptionColorizer->colorize(sprintf($locale->_('Exception throwed in file %s on line %d'), $file, $line))) . PHP_EOL . $exceptionPrompt . $value . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . $exceptionPrompt . sprintf($locale->_('%s:'), $exceptionColorizer->colorize(sprintf($locale->_('Exception throwed in file %s on line %d'), $otherFile, $otherLine))) . PHP_EOL . $exceptionPrompt . $firstOtherValue . PHP_EOL . $exceptionPrompt . $secondOtherValue . PHP_EOL);
 }