示例#1
0
 public function __construct()
 {
     parent::__construct();
     $secondLevelPrompt = new prompt('   ');
     $thirdLevelPrompt = new prompt('      ');
     $this->addField(new runner\php\path\cli());
     $phpVersionField = new runner\php\version\cli();
     $phpVersionField->setVersionPrompt($secondLevelPrompt);
     $this->addField($phpVersionField);
     $this->addField(new runner\duration\cli())->addField(new runner\result\cli());
     $failuresField = new runner\failures\cli();
     $failuresField->setMethodPrompt($secondLevelPrompt);
     $this->addField($failuresField);
     $outputsField = new runner\outputs\cli();
     $outputsField->setMethodPrompt($secondLevelPrompt);
     $this->addField($outputsField);
     $errorsField = new runner\errors\cli();
     $errorsField->setMethodPrompt($secondLevelPrompt)->setErrorPrompt($thirdLevelPrompt);
     $this->addField($errorsField);
     $exceptionsField = new runner\exceptions\cli();
     $exceptionsField->setMethodPrompt($secondLevelPrompt)->setExceptionPrompt($thirdLevelPrompt);
     $this->addField($exceptionsField);
     $uncompletedField = new runner\tests\uncompleted\cli();
     $uncompletedField->setMethodPrompt($secondLevelPrompt)->setOutputPrompt($thirdLevelPrompt);
     $this->addField($uncompletedField);
     $this->addField(new runner\tests\duration\cli())->addField(new runner\tests\memory\cli());
     $coverageField = new runner\tests\coverage\cli();
     $coverageField->setClassPrompt($secondLevelPrompt)->setMethodPrompt($thirdLevelPrompt);
     $this->addField($coverageField)->addField(new test\run\cli());
     $durationField = new test\duration\cli();
     $durationField->setPrompt($secondLevelPrompt);
     $this->addField($durationField);
     $memoryField = new test\memory\cli();
     $memoryField->setPrompt($secondLevelPrompt);
     $this->addField($memoryField);
 }
示例#2
0
 public function test__toString()
 {
     $this->if($runner = new mock\runner())->and($runner->getMockController()->getScore = $score = new mock\score())->and($defaultField = new runner\errors\cli())->and($customField = new runner\errors\cli($titlePrompt = new prompt(uniqid()), $titleColorizer = new colorizer(uniqid(), uniqid()), $methodPrompt = new prompt(uniqid()), $methodColorizer = new colorizer(uniqid(), uniqid()), $errorPrompt = new prompt(uniqid()), $errorColorizer = new colorizer(uniqid(), uniqid()), $locale = new atoum\locale()))->and($score->getMockController()->getErrors = array())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->if($score->getMockController()->getErrors = $allErrors = array(array('case' => null, 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = rand(1, PHP_INT_MAX), 'type' => $type = 'e_fake_error', 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX)), array('case' => null, 'class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = rand(1, PHP_INT_MAX), 'type' => $otherType = 'e_other_fake_error', 'message' => ($firstOtherMessage = uniqid()) . PHP_EOL . ($secondOtherMessage = uniqid()), 'errorFile' => $otherErrorFile = uniqid(), 'errorLine' => $otherErrorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d errors:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in %s on line %d, generated by file %s on line %d:', strtoupper($type), $file, $line, $errorFile, $errorLine) . PHP_EOL . $message . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('Error %s in %s on line %d, generated by file %s on line %d:', strtoupper($otherType), $otherFile, $otherLine, $otherErrorFile, $otherErrorLine) . PHP_EOL . $firstOtherMessage . PHP_EOL . $secondOtherMessage . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on line %d, generated by file %s on line %d'), strtoupper($type), $file, $line, $errorFile, $errorLine))) . PHP_EOL . $message . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on line %d, generated by file %s on line %d'), strtoupper($otherType), $otherFile, $otherLine, $otherErrorFile, $otherErrorLine))) . PHP_EOL . $firstOtherMessage . PHP_EOL . $secondOtherMessage . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => $case = uniqid(), 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = rand(1, PHP_INT_MAX), 'type' => $type = rand(1, PHP_INT_MAX), 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX)), array('case' => $otherCase = uniqid(), 'class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = rand(1, PHP_INT_MAX), 'type' => $otherType = rand(1, PHP_INT_MAX), 'message' => ($firstOtherMessage = uniqid()) . PHP_EOL . ($secondOtherMessage = uniqid()), 'errorFile' => $otherErrorFile = uniqid(), 'errorLine' => $otherErrorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d errors:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in %s on line %d, generated by file %s on line %d in case \'%s\':', strtoupper($type), $file, $line, $errorFile, $errorLine, $case) . PHP_EOL . $message . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('Error %s in %s on line %d, generated by file %s on line %d in case \'%s\':', strtoupper($otherType), $otherFile, $otherLine, $otherErrorFile, $otherErrorLine, $otherCase) . PHP_EOL . $firstOtherMessage . PHP_EOL . $secondOtherMessage . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on line %d, generated by file %s on line %d in case \'%s\''), strtoupper($type), $file, $line, $errorFile, $errorLine, $case))) . PHP_EOL . $message . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on line %d, generated by file %s on line %d in case \'%s\''), strtoupper($otherType), $otherFile, $otherLine, $otherErrorFile, $otherErrorLine, $otherCase))) . PHP_EOL . $firstOtherMessage . PHP_EOL . $secondOtherMessage . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => null, 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => null, 'line' => null, 'type' => $type = rand(1, PHP_INT_MAX), 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in unknown file on unknown line, generated by file %s on line %d:', strtoupper($type), $errorFile, $errorLine) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in unknown file on unknown line, generated by file %s on line %d'), strtoupper($type), $errorFile, $errorLine))) . PHP_EOL . $message . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => $case = uniqid(), 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => null, 'line' => null, 'type' => $type = rand(1, PHP_INT_MAX), 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in unknown file on unknown line, generated by file %s on line %d in case \'%s\':', strtoupper($type), $errorFile, $errorLine, $case) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in unknown file on unknown line, generated by file %s on line %d in case \'%s\''), strtoupper($type), $errorFile, $errorLine, $case))) . PHP_EOL . $message . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => null, 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => null, 'line' => $line = rand(1, PHP_INT_MAX), 'type' => $type = 'e_fake_error', 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in unknown file on unknown line, generated by file %s on line %d:', strtoupper($type), $errorFile, $errorLine) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in unknown file on unknown line, generated by file %s on line %d'), strtoupper($type), $errorFile, $errorLine))) . PHP_EOL . $message . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => $case = uniqid(), 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => null, 'type' => $type = 'e_fake_error', 'message' => $message = uniqid(), 'errorFile' => null, 'errorLine' => null)))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in %s on unknown line, generated by unknown file in case \'%s\':', strtoupper($type), $file, $case) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on unknown line, generated by unknown file in case \'%s\''), strtoupper($type), $file, $case))) . PHP_EOL . $message . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => $case = uniqid(), 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => null, 'line' => $line = rand(1, PHP_INT_MAX), 'type' => $type = 'e_fake_error', 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in unknown file on unknown line, generated by file %s on line %d in case \'%s\':', strtoupper($type), $errorFile, $errorLine, $case) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in unknown file on unknown line, generated by file %s on line %d in case \'%s\''), strtoupper($type), $errorFile, $errorLine, $case))) . PHP_EOL . $message . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => null, 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => null, 'type' => $type = 'e_fake_error', 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in %s on unknown line, generated by file %s on line %d:', strtoupper($type), $file, $errorFile, $errorLine) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on unknown line, generated by file %s on line %d'), strtoupper($type), $file, $errorFile, $errorLine))) . PHP_EOL . $message . PHP_EOL)->if($score->getMockController()->getErrors = $allErrors = array(array('case' => $case = uniqid(), 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => null, 'type' => $type = 'e_fake_error', 'message' => $message = uniqid(), 'errorFile' => $errorFile = uniqid(), 'errorLine' => $errorLine = rand(1, PHP_INT_MAX))))->and($defaultField = new runner\errors\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There is %d error:', sizeof($allErrors)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Error %s in %s on unknown line, generated by file %s on line %d in case \'%s\':', strtoupper($type), $file, $errorFile, $errorLine, $case) . PHP_EOL . $message . PHP_EOL)->if($customField = new runner\errors\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setErrorPrompt($errorPrompt = new prompt(uniqid())))->and($customField->setErrorColorizer($errorColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d error', 'There are %d errors', sizeof($allErrors)), sizeof($allErrors)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $errorPrompt . sprintf($locale->_('%s:'), $errorColorizer->colorize(sprintf($locale->_('Error %s in %s on unknown line, generated by file %s on line %d in case \'%s\''), strtoupper($type), $file, $errorFile, $errorLine, $case))) . PHP_EOL . $message . PHP_EOL);
 }
示例#3
0
 public function test__construct()
 {
     $this->define($phpVersionField = new runner\php\version\cli())->and($phpVersionField->setVersionPrompt(new prompt('   ')))->define($failuresField = new runner\failures\cli())->and($failuresField->setMethodPrompt(new prompt('   ')))->define($outputsField = new runner\outputs\cli())->and($outputsField->setMethodPrompt(new prompt('   ')))->define($errorsField = new runner\errors\cli())->and($errorsField->setMethodPrompt(new prompt('   '))->setErrorPrompt(new prompt('      ')))->define($exceptionsField = new runner\exceptions\cli())->and($exceptionsField->setMethodPrompt(new prompt('   '))->setExceptionPrompt(new prompt('      ')))->define($uncompletedField = new runner\tests\uncompleted\cli())->and($uncompletedField->setMethodPrompt(new prompt('   '))->setOutputPrompt(new prompt('      ')))->define($coverageField = new runner\tests\coverage\cli())->and($coverageField->setClassPrompt(new prompt('   '))->setMethodPrompt(new prompt('      ')))->define($durationField = new test\duration\cli())->and($durationField->setPrompt(new prompt('   ')))->define($memoryField = new test\memory\cli())->and($memoryField->setPrompt(new prompt('   ')))->if($report = new testedClass())->then->object($report->getLocale())->isEqualTo(new atoum\locale())->object($report->getAdapter())->isEqualTo(new atoum\adapter())->array($report->getFields())->isEqualTo(array(new runner\php\path\cli(), $phpVersionField, new runner\duration\cli(), new runner\result\cli(), $failuresField, $outputsField, $errorsField, $exceptionsField, $uncompletedField, new runner\tests\duration\cli(), new runner\tests\memory\cli(), $coverageField, new test\run\cli(), $durationField, $memoryField));
 }