public function __construct(progressBar $progressBar = null) { parent::__construct($progressBar); $this->snowColorizer = new colorizer(38); $red = new colorizer(31); $black = new colorizer('1;30'); $brown = new colorizer('38;5;94'); $this->sprite = array(' _ ', ' {_} ', $red->colorize(' / \\ '), $red->colorize(' / \\ '), $red->colorize(' /_____\\ '), ' {`_______`} ', ' // . . \\\\ ', ' (/(__7__)\\) ', ' |\'-` = `-\'| ', ' | | ', $red->colorize(' /') . '\\ /' . $red->colorize('\\ '), $red->colorize(' / ') . '\'. .\'' . $red->colorize(' \\ '), $red->colorize(' /_/') . ' `"` ' . $red->colorize('\\_\\ '), ' {__}' . $brown->colorize('###') . $black->colorize('[_]') . $brown->colorize('###') . '{__} ', ' (_/' . $red->colorize('\\_________/') . '\\_) ', $red->colorize(' |___|___| '), $red->colorize(' |--|--| '), $brown->colorize(' (__)') . '`' . $brown->colorize('(__) ')); }
public function setErrorWriter(atoum\writer $writer = null) { parent::setErrorWriter($writer); if ($writer === null) { $colorizer = new cli\colorizer('0;31'); $colorizer->setPattern('/^([^:]+:)/'); $this->errorWriter->addDecorator($colorizer); } return $this; }
public function testColorize() { $colorizer = new cli\colorizer(null, null, $cli = new \mock\mageekguy\atoum\cli()); $cli->getMockController()->isTerminal = true; $this->assert->string($colorizer->colorize($string = uniqid()))->isEqualTo($string); $colorizer = new cli\colorizer($foreground = uniqid(), null, $cli); $this->assert->string($colorizer->colorize($string = uniqid()))->isEqualTo("[" . $foreground . 'm' . $string . "[0m"); $colorizer = new cli\colorizer($foreground = uniqid(), $background = uniqid(), $cli); $this->assert->string($colorizer->colorize($string = uniqid()))->isEqualTo("[" . $foreground . 'm' . "[" . $background . 'm' . $string . "[0m"); $colorizer = new cli\colorizer(null, $background = uniqid(), $cli); $this->assert->string($colorizer->colorize($string = uniqid()))->isEqualTo("[" . $background . 'm' . $string . "[0m"); $colorizer = new cli\colorizer($foreground = uniqid(), $background = uniqid(), $cli); $cli->getMockController()->isTerminal = false; $this->assert->string($colorizer->colorize($string = uniqid()))->isEqualTo($string); }
/** * {@inheritdoc} * * @see \mageekguy\atoum\report\fields\runner\coverage\cli::__toString() */ public function __toString() { $string = ''; if (sizeof($this->coverage) > 0) { try { // clean directory $this->cleanDestinationDirectory(); // generate assets $this->generateAssets(); // get coverage report $report = $this->getCoverageReport($this->coverage); // generate index page for each directory foreach ($report['directories'] as $directoryPath => $directoryData) { // build page $this->buildDirectoryPage($directoryPath, $directoryData, $report['directories']['/']['relevantLines'], $report['directories']['/']['coveredLines'], $report['directories']['/']['totalLines'], $report['directories']['/']['coverage']); } // generate class page for each file foreach ($report['sources'] as $classData) { // build page $this->buildClassPage($classData, $report['directories']['/']['relevantLines'], $report['directories']['/']['coveredLines'], $report['directories']['/']['totalLines'], $report['directories']['/']['coverage']); } } catch (\exception $exception) { $string .= $this->urlColorizer->colorize($this->locale->_('Unable to generate code coverage at %s: %s.', $this->rootUrl, $exception->getMessage())) . PHP_EOL; } } return $string; }
public function test__toString() { $this->if($scoreCoverage = new score\coverage())->and($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getCoverage = function () use($scoreCoverage) { return $scoreCoverage; })->and($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField = new tests\coverage\cli())->and($customField = new tests\coverage\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setClassPrompt($classPrompt = new prompt(uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setCoverageColorizer($coverageColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($classController = new mock\controller())->and($classController->disableMethodChecking())->and($classController->__construct = function () { })->and($classController->getName = function () use(&$className) { return $className; })->and($classController->getFileName = function () use(&$classFile) { return $classFile; })->and($classController->getTraits = array())->and($classController->getStartLine = 1)->and($classController->getEndLine = 12)->and($class = new \mock\reflectionClass(uniqid(), $classController))->and($methodController = new mock\controller())->and($methodController->__construct = function () { })->and($methodController->isAbstract = false)->and($methodController->getFileName = function () use(&$classFile) { return $classFile; })->and($methodController->getDeclaringClass = $class)->and($methodController->getName = function () use(&$methodName) { return $methodName; })->and($methodController->getStartLine = 6)->and($methodController->getEndLine = 8)->and($classController->getMethods = array(new \mock\reflectionMethod(uniqid(), uniqid(), $methodController)))->and($className = uniqid())->and($methodName = uniqid())->and($scoreCoverage->setReflectionClassFactory(function () use($class) { return $class; }))->and($scoreCoverage->addXdebugDataForTest($this, $xdebugData = array($classFile = uniqid() => array(5 => 1, 6 => 2, 7 => 3, 8 => 2, 9 => 1), uniqid() => array(5 => 2, 6 => 3, 7 => 4, 8 => 3, 9 => 2))))->and($defaultField = new tests\coverage\cli())->and($customField = new tests\coverage\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setClassPrompt($classPrompt = new prompt(uniqid())))->and($customField->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($customField->setCoverageColorizer($coverageColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getTitlePrompt() . sprintf($defaultField->getLocale()->_('Code coverage value: %3.2f%%'), $scoreCoverage->getValue() * 100) . PHP_EOL . $defaultField->getClassPrompt() . sprintf($defaultField->getLocale()->_('Class %s: %3.2f%%'), $className, $scoreCoverage->getValueForClass($className) * 100.0) . PHP_EOL . $defaultField->getMethodPrompt() . sprintf($defaultField->getLocale()->_('%s::%s(): %3.2f%%'), $className, $methodName, $scoreCoverage->getValueForMethod($className, $methodName) * 100.0) . PHP_EOL)->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s: %s'), $titleColorizer->colorize($locale->_('Code coverage value')), $coverageColorizer->colorize(sprintf('%3.2f%%', $scoreCoverage->getValue() * 100.0))) . PHP_EOL . $classPrompt . sprintf($locale->_('%s: %s'), $titleColorizer->colorize(sprintf($locale->_('Class %s'), $className)), $coverageColorizer->colorize(sprintf('%3.2f%%', $scoreCoverage->getValueForClass($className) * 100.0))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s: %s'), $titleColorizer->colorize(sprintf($locale->_('%s::%s()'), $className, $methodName)), $coverageColorizer->colorize(sprintf('%3.2f%%', $scoreCoverage->getValueForClass($className, $methodName) * 100.0))) . PHP_EOL)->if($defaultField->hideMethodsCoverageDetails())->and($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getTitlePrompt() . sprintf($defaultField->getLocale()->_('Code coverage value: %3.2f%%'), $scoreCoverage->getValue() * 100) . PHP_EOL . $defaultField->getClassPrompt() . sprintf($defaultField->getLocale()->_('Class %s: %3.2f%%'), $className, $scoreCoverage->getValueForClass($className) * 100.0) . PHP_EOL)->if($defaultField->hideClassesCoverageDetails())->and($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getTitlePrompt() . sprintf($defaultField->getLocale()->_('Code coverage value: %3.2f%%'), $scoreCoverage->getValue() * 100) . PHP_EOL)->if($customField->hideClassesCoverageDetails())->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($customField->getTitlePrompt() . sprintf($customField->getLocale()->_('Code coverage value: %3.2f%%'), $scoreCoverage->getValue() * 100) . PHP_EOL); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getTotalDuration = $totalDuration = rand(1, 100) / 1000)->and($runner = new \mock\mageekguy\atoum\runner())->and($runner->setScore($score))->and($runner->getMockController()->getTestNumber = $testNumber = 1)->and($defaultField = new tests\duration\cli())->and($customField = new tests\duration\cli())->and($customField->setPrompt($prompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setDurationColorizer($durationColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getLocale()->_('Total test duration: unknown.') . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf('%s: %s.', $titleColorizer->colorize($locale->_('Total test duration')), $durationColorizer->colorize($locale->_('unknown'))) . PHP_EOL)->if($defaultField->handleEvent(atoum\runner::runStart, new atoum\runner()))->and($customField->handleEvent(atoum\runner::runStart, new atoum\runner()))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getLocale()->_('Total test duration: unknown.') . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf('%s: %s.', $titleColorizer->colorize($locale->_('Total test duration')), $durationColorizer->colorize($locale->_('unknown'))) . PHP_EOL)->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . sprintf($defaultField->getLocale()->__('Total test duration: %s.', 'Total tests duration: %s.', $testNumber), sprintf($defaultField->getLocale()->__('%4.2f second', '%4.2f seconds', $totalDuration), $totalDuration)) . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf('%s: %s.', $titleColorizer->colorize($locale->__('Total test duration', 'Total tests duration', $testNumber)), $durationColorizer->colorize(sprintf($locale->__('%4.2f second', '%4.2f seconds', $totalDuration), $totalDuration))) . PHP_EOL)->if($runner->getMockController()->getTestNumber = $testNumber = rand(2, PHP_INT_MAX))->and($defaultField = new tests\duration\cli())->and($customField = new tests\duration\cli())->and($customField->setPrompt($prompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setDurationColorizer($durationColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getLocale()->_('Total test duration: unknown.') . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf('%s: %s.', $titleColorizer->colorize($locale->_('Total test duration')), $durationColorizer->colorize($locale->_('unknown'))) . PHP_EOL)->if($defaultField->handleEvent(atoum\runner::runStart, new atoum\runner()))->and($customField->handleEvent(atoum\runner::runStart, new atoum\runner()))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getLocale()->_('Total test duration: unknown.') . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf('%s: %s.', $titleColorizer->colorize($locale->_('Total test duration')), $durationColorizer->colorize($locale->_('unknown'))) . PHP_EOL)->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . sprintf($defaultField->getLocale()->__('Total test duration: %s.', 'Total tests duration: %s.', $testNumber), sprintf($defaultField->getLocale()->__('%4.2f second', '%4.2f seconds', $totalDuration), $totalDuration)) . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf('%s: %s.', $titleColorizer->colorize($locale->__('Total test duration', 'Total tests duration', $testNumber)), $durationColorizer->colorize(sprintf($locale->__('%4.2f second', '%4.2f seconds', $totalDuration), $totalDuration))) . PHP_EOL); }
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); }
public function test__toString() { $this->if($adapter = new adapter())->and($adapter->class_exists = true)->and($score = new \mock\mageekguy\atoum\score())->and($score->getMockController()->getTotalDuration = $runningDuration = rand(1, 1000) / 1000)->and($testController = new mock\controller())->and($testController->getTestedClassName = uniqid())->and($testController->getScore = $score)->and($test = new \mock\mageekguy\atoum\test($adapter))->and($defaultField = new test\duration\phing())->and($customField = new test\duration\phing())->and($customField->setPrompt($prompt = new prompt()))->and($customField->setTitleColorizer($titleColorizer = new colorizer()))->and($customField->setDurationColorizer($durationColorizer = new colorizer()))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEqualTo('unknown')->castToString($customField)->isEqualTo($prompt . sprintf('%s', $locale->_('unknown')))->if($defaultField->handleEvent(atoum\runner::runStop, $test))->then->castToString($defaultField)->isEqualTo('unknown')->if($customField->handleEvent(atoum\runner::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf('%s', $locale->_('unknown')))->if($defaultField->handleEvent(atoum\test::runStop, $test))->then->castToString($defaultField)->isEqualTo(sprintf('%4.2f s', $runningDuration))->if($customField->handleEvent(atoum\test::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf('%s', $durationColorizer->colorize(sprintf($locale->__('%4.2f s', '%4.2f s', $runningDuration), $runningDuration))))->if($score->getMockController()->getTotalDuration = $runningDuration = rand(2, PHP_INT_MAX))->and($defaultField = new test\duration\phing())->and($customField = new test\duration\phing())->and($customField->setPrompt($prompt = new prompt()))->and($customField->setTitleColorizer($titleColorizer = new colorizer()))->and($customField->setDurationColorizer($durationColorizer = new colorizer()))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEqualTo('unknown')->castToString($customField)->isEqualTo($prompt . sprintf('%s', $locale->_('unknown')))->if($defaultField->handleEvent(atoum\runner::runStop, $test))->then->castToString($defaultField)->isEqualTo('unknown')->if($customField->handleEvent(atoum\runner::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf('%s', $locale->_('unknown')))->if($defaultField->handleEvent(atoum\test::runStop, $test))->then->castToString($defaultField)->isEqualTo(sprintf('%4.2f s', $runningDuration))->if($customField->handleEvent(atoum\test::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf('%s', $durationColorizer->colorize(sprintf($locale->__('%4.2f s', '%4.2f s', $runningDuration), $runningDuration)))); }
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); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($this->calling($score)->getUncompletedMethods = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField = new tests\uncompleted\cli())->and($customField = new tests\uncompleted\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->setOutputPrompt($outputPrompt = new prompt(uniqid())))->and($customField->setOutputColorizer($outputColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEmpty()->if($score->getMockController()->getUncompletedMethods = $allUncompletedMethods = array(array('class' => $class = uniqid(), 'method' => $method = uniqid(), 'exitCode' => $exitCode = rand(1, PHP_INT_MAX), 'output' => $output = uniqid()), array('class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'exitCode' => $otherExitCode = rand(1, PHP_INT_MAX), 'output' => ($otherOutputLine1 = uniqid()) . PHP_EOL . ($otherOutputLine2 = uniqid())), array('class' => $anotherClass = uniqid(), 'method' => $anotherMethod = uniqid(), 'exitCode' => $anotherExitCode = rand(1, PHP_INT_MAX), 'output' => '')))->and($defaultField = new tests\uncompleted\cli())->and($customField = new tests\uncompleted\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->setOutputPrompt($outputPrompt = new prompt(uniqid())))->and($customField->setOutputColorizer($outputColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d uncompleted methods:', sizeof($allUncompletedMethods)) . PHP_EOL . sprintf('%s::%s() with exit code %d:', $class, $method, $exitCode) . PHP_EOL . 'output(' . strlen($output) . ') "' . $output . '"' . PHP_EOL . sprintf('%s::%s() with exit code %d:', $otherClass, $otherMethod, $otherExitCode) . PHP_EOL . 'output(' . strlen($otherOutputLine1 . PHP_EOL . $otherOutputLine2) . ') "' . $otherOutputLine1 . PHP_EOL . $otherOutputLine2 . '"' . PHP_EOL . sprintf('%s::%s() with exit code %d:', $anotherClass, $anotherMethod, $anotherExitCode) . PHP_EOL . 'output(0) ""' . PHP_EOL)->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d uncompleted method', 'There are %d uncompleted methods', sizeof($allUncompletedMethods)), sizeof($allUncompletedMethods)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize(sprintf('%s::%s() with exit code %d', $class, $method, $exitCode))) . PHP_EOL . $outputPrompt . 'output(' . strlen($output) . ') "' . $output . '"' . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize(sprintf('%s::%s() with exit code %d', $otherClass, $otherMethod, $otherExitCode))) . PHP_EOL . $outputPrompt . 'output(' . strlen($otherOutputLine1 . PHP_EOL . $otherOutputLine2) . ') "' . $otherOutputLine1 . PHP_EOL . $outputPrompt . $otherOutputLine2 . '"' . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize(sprintf('%s::%s() with exit code %d', $anotherClass, $anotherMethod, $anotherExitCode))) . PHP_EOL . $outputPrompt . 'output(0) ""' . PHP_EOL); }
public function testSetErrorWriter() { $this->given($runner = new testedClass(uniqid()))->then->object($runner->setErrorWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)->object($runner->getErrorWriter())->isIdenticalTo($errorWriter)->given($colorizer = new cli\colorizer('0;31'))->and($colorizer->setPattern('/^([^:]+:)/'))->and($defaultErrorWriter = new atoum\writers\std\err())->and($defaultErrorWriter->addDecorator($colorizer))->then->object($runner->setErrorWriter())->isIdenticalTo($runner)->object($runner->getErrorWriter())->isEqualTo($defaultErrorWriter); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getTotalMemoryUsage = function () use(&$totalMemoryUsage) { return $totalMemoryUsage = rand(1, PHP_INT_MAX); })->and($runner = new \mock\mageekguy\atoum\runner())->and($runner->setScore($score))->and($runner->getMockController()->getTestNumber = $testNumber = rand(1, PHP_INT_MAX))->and($defaultField = new memory\cli())->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getTitleColorizer()->colorize($defaultField->getLocale()->__('Total test memory usage', 'Total tests memory usage', 0)) . ': ' . $defaultField->getMemoryColorizer()->colorize($defaultField->getLocale()->_('unknown')) . '.' . PHP_EOL)->if($customField = new memory\cli())->and($customField->setPrompt($prompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMemoryColorizer($memoryColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($customField)->isEqualTo($prompt . $titleColorizer->colorize($locale->__('Total test memory usage', 'Total tests memory usage', 0)) . ': ' . $memoryColorizer->colorize($locale->_('unknown')) . '.' . PHP_EOL)->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getTitleColorizer()->colorize($defaultField->getLocale()->__('Total test memory usage', 'Total tests memory usage', 0)) . ': ' . $defaultField->getMemoryColorizer()->colorize($defaultField->getLocale()->_('unknown')) . '.' . PHP_EOL)->if($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEqualTo($prompt . $titleColorizer->colorize($locale->__('Total test memory usage', 'Total tests memory usage', 0)) . ': ' . $memoryColorizer->colorize($locale->_('unknown')) . '.' . PHP_EOL)->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getTitleColorizer()->colorize($defaultField->getLocale()->__('Total test memory usage', 'Total tests memory usage', $testNumber)) . ': ' . $defaultField->getMemoryColorizer()->colorize(sprintf($defaultField->getLocale()->_('%4.2f Mb'), $totalMemoryUsage / 1048576)) . '.' . PHP_EOL)->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($prompt . $titleColorizer->colorize($locale->__('Total test memory usage', 'Total tests memory usage', $testNumber)) . ': ' . $memoryColorizer->colorize(sprintf($locale->_('%4.2f Mb'), $totalMemoryUsage / 1048576)) . '.' . PHP_EOL); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getOutputs = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField = new outputs\cli())->and($customField = new outputs\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->setOutputPrompt($outputPrompt = new prompt(uniqid())))->and($customField->setOutputColorizer($outputColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($score->getMockController()->getOutputs = $fields = array(array('class' => $class = uniqid(), 'method' => $method = uniqid(), 'value' => $value = uniqid()), array('class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'value' => ($firstOtherValue = uniqid()) . PHP_EOL . ($secondOtherValue = uniqid()))))->and($defaultField = new outputs\cli())->and($customField = new outputs\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->setOutputPrompt($outputPrompt = new prompt(uniqid())))->and($customField->setOutputColorizer($outputColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d outputs:', sizeof($fields)) . PHP_EOL . 'In ' . $class . '::' . $method . '():' . PHP_EOL . $value . PHP_EOL . 'In ' . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . $firstOtherValue . PHP_EOL . $secondOtherValue . PHP_EOL)->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d output', 'There are %d outputs', sizeof($fields)), sizeof($fields)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize('In ' . $class . '::' . $method . '()')) . PHP_EOL . $outputPrompt . $outputColorizer->colorize($value) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize('In ' . $otherClass . '::' . $otherMethod . '()')) . PHP_EOL . $outputPrompt . $outputColorizer->colorize($firstOtherValue) . PHP_EOL . $outputPrompt . $outputColorizer->colorize($secondOtherValue) . PHP_EOL)->if($score->getMockController()->getOutputs = $fields = array(array('class' => $class = uniqid(), 'method' => $method = uniqid(), 'value' => $value = uniqid()), array('class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'value' => ($firstOtherValue = uniqid()) . PHP_EOL . ($secondOtherValue = uniqid()))))->and($defaultField = new outputs\cli())->and($customField = new outputs\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->setOutputPrompt($outputPrompt = new prompt(uniqid())))->and($customField->setOutputColorizer($outputColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->castToString($defaultField)->isEqualTo(sprintf('There are %d outputs:', sizeof($fields)) . PHP_EOL . 'In ' . $class . '::' . $method . '():' . PHP_EOL . $value . PHP_EOL . 'In ' . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . $firstOtherValue . PHP_EOL . $secondOtherValue . PHP_EOL)->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d output', 'There are %d outputs', sizeof($fields)), sizeof($fields)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize('In ' . $class . '::' . $method . '()')) . PHP_EOL . $outputPrompt . $outputColorizer->colorize($value) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize('In ' . $otherClass . '::' . $otherMethod . '()')) . PHP_EOL . $outputPrompt . $outputColorizer->colorize($firstOtherValue) . PHP_EOL . $outputPrompt . $outputColorizer->colorize($secondOtherValue) . PHP_EOL); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($this->calling($score)->getSkippedMethods = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField = new testedClass())->and($customField = new testedClass())->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->setMessageColorizer($messageColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEmpty()->if($score->getMockController()->getSkippedMethods = $allSkippedMethods = array(array('class' => $class = uniqid(), 'method' => $method = uniqid(), 'message' => $message = uniqid()), array('class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'message' => $otherMessage = uniqid()), array('class' => $anotherClass = uniqid(), 'method' => $anotherMethod = uniqid(), 'message' => $anotherMessage = uniqid())))->and($defaultField = new testedClass())->and($customField = new testedClass())->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->setMessageColorizer($messageColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->if($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d skipped methods:', sizeof($allSkippedMethods)) . PHP_EOL . sprintf('%s::%s(): %s', $class, $method, $message) . PHP_EOL . sprintf('%s::%s(): %s', $otherClass, $otherMethod, $otherMessage) . PHP_EOL . sprintf('%s::%s(): %s', $anotherClass, $anotherMethod, $anotherMessage) . PHP_EOL)->if($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d skipped method', 'There are %d skipped methods', sizeof($allSkippedMethods)), sizeof($allSkippedMethods)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s: %s'), $methodColorizer->colorize(sprintf('%s::%s()', $class, $method)), $messageColorizer->colorize($message)) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s: %s'), $methodColorizer->colorize(sprintf('%s::%s()', $otherClass, $otherMethod)), $messageColorizer->colorize($otherMessage)) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s: %s'), $methodColorizer->colorize(sprintf('%s::%s()', $anotherClass, $anotherMethod)), $messageColorizer->colorize($anotherMessage)) . PHP_EOL); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getErrors = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField = new runner\failures\cli())->and($customField = new runner\failures\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->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStart, $runner))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($score->getMockController()->getFailAssertions = $fails = array(array('case' => null, 'dataSetKey' => null, 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = uniqid(), 'asserter' => $asserter = uniqid(), 'fail' => $fail = uniqid()), array('case' => null, 'dataSetKey' => null, 'class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = uniqid(), 'asserter' => $otherAsserter = uniqid(), 'fail' => $otherFail = uniqid())))->and($defaultField = new runner\failures\cli())->and($customField = new runner\failures\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->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d failures:', sizeof($fails)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('In file %s on line %d, %s failed: %s', $file, $line, $asserter, $fail) . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('In file %s on line %d, %s failed: %s', $otherFile, $otherLine, $otherAsserter, $otherFail) . PHP_EOL)->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d failure', 'There are %d failures', sizeof($fails)), sizeof($fails)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . sprintf($locale->_('In file %s on line %d, %s failed: %s'), $file, $line, $asserter, $fail) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . sprintf($locale->_('In file %s on line %d, %s failed: %s'), $otherFile, $otherLine, $otherAsserter, $otherFail) . PHP_EOL)->if($score->getMockController()->getFailAssertions = $fails = array(array('case' => $case = uniqid(), 'dataSetKey' => null, 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = uniqid(), 'asserter' => $asserter = uniqid(), 'fail' => $fail = uniqid()), array('case' => $otherCase = uniqid(), 'dataSetKey' => null, 'class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = uniqid(), 'asserter' => $otherAsserter = uniqid(), 'fail' => $otherFail = uniqid())))->and($defaultField = new runner\failures\cli())->and($customField = new runner\failures\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->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d failures:', sizeof($fails)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('In file %s on line %d in case \'%s\', %s failed: %s', $file, $line, $case, $asserter, $fail) . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('In file %s on line %d in case \'%s\', %s failed: %s', $otherFile, $otherLine, $otherCase, $otherAsserter, $otherFail) . PHP_EOL)->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d failure', 'There are %d failures', sizeof($fails)), sizeof($fails)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . sprintf($locale->_('In file %s on line %d in case \'%s\', %s failed: %s'), $file, $line, $case, $asserter, $fail) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . sprintf($locale->_('In file %s on line %d in case \'%s\', %s failed: %s'), $otherFile, $otherLine, $otherCase, $otherAsserter, $otherFail) . PHP_EOL)->if($score->getMockController()->getFailAssertions = $fails = array(array('case' => $case = uniqid(), 'dataSetKey' => $dataSetKey = rand(1, PHP_INT_MAX), 'dataSetProvider' => $dataSetProvider = uniqid(), 'class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = uniqid(), 'asserter' => $asserter = uniqid(), 'fail' => $fail = uniqid()), array('case' => $otherCase = uniqid(), 'dataSetKey' => $otherDataSetKey = rand(1, PHP_INT_MAX), 'dataSetProvider' => $otherDataSetProvider = uniqid(), 'class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = uniqid(), 'asserter' => $otherAsserter = uniqid(), 'fail' => $otherFail = uniqid())))->and($defaultField = new runner\failures\cli())->and($customField = new runner\failures\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->setLocale($locale = new atoum\locale()))->then->castToString($defaultField)->isEmpty()->castToString($customField)->isEmpty()->if($defaultField->handleEvent(atoum\runner::runStop, $runner))->and($customField->handleEvent(atoum\runner::runStop, $runner))->then->castToString($defaultField)->isEqualTo(sprintf('There are %d failures:', sizeof($fails)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('In file %s on line %d in case \'%s\', %s failed for data set #%s of data provider %s: %s', $file, $line, $case, $asserter, $dataSetKey, $dataSetProvider, $fail) . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('In file %s on line %d in case \'%s\', %s failed for data set #%s of data provider %s: %s', $otherFile, $otherLine, $otherCase, $otherAsserter, $otherDataSetKey, $otherDataSetProvider, $otherFail) . PHP_EOL)->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($locale->__('There is %d failure', 'There are %d failures', sizeof($fails)), sizeof($fails)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . sprintf($locale->_('In file %s on line %d in case \'%s\', %s failed for data set #%s of data provider %s: %s'), $file, $line, $case, $asserter, $dataSetKey, $dataSetProvider, $fail) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . sprintf($locale->_('In file %s on line %d in case \'%s\', %s failed for data set #%s of data provider %s: %s'), $otherFile, $otherLine, $otherCase, $otherAsserter, $otherDataSetKey, $otherDataSetProvider, $otherFail) . PHP_EOL); }
public function testSetHelpWriter() { $this->if($script = new mock\script($name = uniqid()))->then->object($script->setHelpWriter($helpWriter = new writers\std\out()))->isIdenticalTo($script)->object($script->getHelpWriter())->isIdenticalTo($helpWriter)->given($labelColorizer = new atoum\cli\colorizer('0;32'), $labelColorizer->setPattern('/(^[^:]+: )/'), $argumentColorizer = new atoum\cli\colorizer('0;32'), $argumentColorizer->setPattern('/((?:^| )[-+]+[-a-z]+)/'), $valueColorizer = new atoum\cli\colorizer('0;34'), $valueColorizer->setPattern('/(<[^>]+>(?:\\.\\.\\.)?)/'), $defaultHelpWriter = new writers\std\out(), $defaultHelpWriter->addDecorator($labelColorizer)->addDecorator($valueColorizer)->addDecorator($argumentColorizer)->addDecorator(new writer\decorators\rtrim())->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear()))->then->object($script->setHelpWriter())->isIdenticalTo($script)->object($script->getHelpWriter())->isEqualTo($defaultHelpWriter); }
public function test__toString() { $this->if($adapter = new adapter())->and($adapter->class_exists = true)->and($testController = new mock\controller())->and($testController->getTestedClassName = uniqid())->and($test = new \mock\mageekguy\atoum\test($adapter))->and($defaultField = new test\run\phing())->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::runStop, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::beforeSetUp, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::afterSetUp, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::beforeTestMethod, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::fail, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::error, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::exception, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::success, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::afterTestMethod, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::beforeTearDown, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::afterTearDown, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.')->if($defaultField->handleEvent(atoum\test::runStart, $test))->then->castToString($defaultField)->isEqualTo(sprintf('%s : ', $test->getClass()))->if($customField = new test\run\phing())->and($customField->setPrompt($prompt = new prompt(uniqid())))->and($customField->setColorizer($colorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::beforeSetUp, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::afterSetUp, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::beforeTestMethod, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::fail, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::error, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::exception, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::success, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::afterTestMethod, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::beforeTearDown, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::afterTearDown, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')))->if($customField->handleEvent(atoum\test::runStart, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%s : '), $colorizer->colorize($test->getClass()))); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getPhpPath = $phpPath = uniqid())->and($defaultField = new runner\php\path\cli())->then->castToString($defaultField)->isEqualTo('PHP path: ' . PHP_EOL)->if($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEqualTo('PHP path:' . ' ' . $phpPath . PHP_EOL)->if($customField = new runner\php\path\cli())->and($customField->setPrompt($prompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setPathColorizer($pathColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%1$s: %2$s'), $titleColorizer->colorize($locale->_('PHP path')), $pathColorizer->colorize('')) . PHP_EOL)->if($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%1$s: %2$s'), $titleColorizer->colorize($locale->_('PHP path')), $pathColorizer->colorize($phpPath)) . PHP_EOL); }
public function setHelpWriter(atoum\writer $writer = null) { if ($writer === null) { $labelColorizer = new cli\colorizer('0;32'); $labelColorizer->setPattern('/(^[^:]+: )/'); $argumentColorizer = new cli\colorizer('0;32'); $argumentColorizer->setPattern('/((?:^| )[-+]+[-a-z]+)/'); $valueColorizer = new cli\colorizer('0;34'); $valueColorizer->setPattern('/(<[^>]+>(?:\\.\\.\\.)?)/'); $writer = new writers\std\out(); $writer->addDecorator($labelColorizer)->addDecorator($valueColorizer)->addDecorator($argumentColorizer)->addDecorator(new writer\decorators\rtrim())->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear()); } $this->helpWriter = $writer; return $this; }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getPhpVersion = $phpVersion = uniqid())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($defaultField = new runner\php\version\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEqualTo($defaultField->getLocale()->_('PHP version:') . PHP_EOL . $phpVersion . PHP_EOL)->if($customField = new runner\php\version\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setVersionPrompt($versionPrompt = new prompt(uniqid())))->and($customField->setVersionColorizer($versionColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize($locale->_('PHP version'))) . PHP_EOL . $versionPrompt . $versionColorizer->colorize($phpVersion) . PHP_EOL)->if($score->getMockController()->getPhpVersion = ($phpVersionLine1 = uniqid()) . PHP_EOL . ($phpVersionLine2 = uniqid()))->and($defaultField = new runner\php\version\cli())->and($defaultField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($defaultField)->isEqualTo('PHP version:' . PHP_EOL . $phpVersionLine1 . PHP_EOL . $phpVersionLine2 . PHP_EOL)->if($customField = new runner\php\version\cli())->and($customField->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setVersionPrompt($versionPrompt = new prompt(uniqid())))->and($customField->setVersionColorizer($versionColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->and($customField->handleEvent(atoum\runner::runStart, $runner))->then->castToString($customField)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize($locale->_('PHP version'))) . PHP_EOL . $versionPrompt . $versionColorizer->colorize($phpVersionLine1) . PHP_EOL . $versionPrompt . $versionColorizer->colorize($phpVersionLine2) . PHP_EOL); }
public function testSetErrorWriter() { $this->given($runner = new testedClass(uniqid()))->then->object($runner->setErrorWriter($errorWriter = new atoum\writers\std\err()))->isIdenticalTo($runner)->object($runner->getErrorWriter())->isIdenticalTo($errorWriter)->given($colorizer = new cli\colorizer('0;31'), $colorizer->setPattern('/^([^:]+:)/'), $defaultErrorWriter = new atoum\writers\std\err(), $defaultErrorWriter->addDecorator(new writer\decorators\trim())->addDecorator(new writer\decorators\prompt($runner->getLocale()->_('Error: ')))->addDecorator(new writer\decorators\eol())->addDecorator(new atoum\cli\clear())->addDecorator($colorizer))->then->object($runner->setErrorWriter())->isIdenticalTo($runner)->object($runner->getErrorWriter())->isEqualTo($defaultErrorWriter); }
public function test__toString() { $this->if($score = new \mock\mageekguy\atoum\score())->and($score->getMockController()->getTotalMemoryUsage = $totalMemoryUsage = rand(0, PHP_INT_MAX))->and($adapter = new atoum\test\adapter())->and($adapter->class_exists = true)->and($testController = new atoum\mock\controller())->and($testController->getTestedClassName = uniqid())->and($test = new \mock\mageekguy\atoum\test($adapter))->and($test->getMockController()->getScore = $score)->and($defaultField = new test\memory\cli())->and($customField = new test\memory\cli())->and($customField->setPrompt($prompt = new prompt(uniqid())))->and($customField->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setMemoryColorizer($memoryColorizer = new colorizer(uniqid(), uniqid())))->and($customField->setLocale($locale = new locale()))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getLocale()->_('Memory usage: unknown.') . PHP_EOL)->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%1$s: %2$s.'), $titleColorizer->colorize($locale->_('Memory usage')), $memoryColorizer->colorize($locale->_('unknown'))) . PHP_EOL)->if($defaultField->handleEvent(atoum\test::runStart, $test))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . $defaultField->getLocale()->_('Memory usage: unknown.') . PHP_EOL)->if($customField->handleEvent(atoum\test::runStart, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%1$s: %2$s.'), $titleColorizer->colorize($locale->_('Memory usage')), $memoryColorizer->colorize($locale->_('unknown'))) . PHP_EOL)->if($defaultField->handleEvent(atoum\test::runStop, $test))->then->castToString($defaultField)->isEqualTo($defaultField->getPrompt() . sprintf($defaultField->getLocale()->_('Memory usage: %4.2f Mb.'), $totalMemoryUsage / 1048576) . PHP_EOL)->if($customField->handleEvent(atoum\test::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%1$s: %2$s.'), $titleColorizer->colorize($locale->_('Memory usage')), $memoryColorizer->colorize(sprintf($locale->_('%4.2f Mb'), $totalMemoryUsage / 1048576))) . PHP_EOL); }
public function testDecorate() { $this->if($colorizer = new cli\colorizer(null, null, $cli = new \mock\mageekguy\atoum\cli()))->and($this->calling($cli)->isTerminal = true)->then->string($colorizer->decorate($string = uniqid()))->isEqualTo($string)->if($colorizer = new cli\colorizer($foreground = uniqid(), null, $cli))->then->string($colorizer->decorate($string = uniqid()))->isEqualTo("[" . $foreground . 'm' . $string . "[0m")->if($colorizer = new cli\colorizer($foreground = uniqid(), $background = uniqid(), $cli))->then->string($colorizer->decorate($string = uniqid()))->isEqualTo("[" . $foreground . 'm' . "[" . $background . 'm' . $string . "[0m")->if($colorizer = new cli\colorizer(null, $background = uniqid(), $cli))->then->string($colorizer->decorate($string = uniqid()))->isEqualTo("[" . $background . 'm' . $string . "[0m")->if($colorizer = new cli\colorizer($foreground = uniqid(), $background = uniqid(), $cli))->and($this->calling($cli)->isTerminal = false)->then->string($colorizer->decorate($string = uniqid()))->isEqualTo($string); }