Example #1
0
 public function test__()
 {
     $locale = new atoum\locale();
     $singular = uniqid();
     $plural = uniqid();
     $this->assert->string($locale->__($singular, $plural, -rand(1, PHP_INT_MAX)))->isEqualTo($singular);
     $this->assert->string($locale->__($singular, $plural, 1))->isEqualTo($singular);
     $this->assert->string($locale->__($singular, $plural, rand(2, PHP_INT_MAX)))->isEqualTo($plural);
 }
Example #2
0
 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);
 }
Example #3
0
 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);
 }
Example #4
0
 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);
 }
Example #5
0
 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);
 }
Example #6
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);
 }
Example #7
0
 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);
 }
Example #8
0
 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);
 }
Example #9
0
 public function test__toString()
 {
     $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getExceptions = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($field = new runner\exceptions\cli())->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEmpty()->if($score->getMockController()->getExceptions = $exceptions = array(array('class' => $class = uniqid(), 'method' => $method = uniqid(), 'file' => $file = uniqid(), 'line' => $line = uniqid(), 'value' => $value = uniqid()), array('class' => $otherClass = uniqid(), 'method' => $otherMethod = uniqid(), 'file' => $otherFile = uniqid(), 'line' => $otherLine = uniqid(), 'value' => ($firstOtherValue = uniqid()) . PHP_EOL . ($secondOtherValue = uniqid()))))->and($field = new runner\exceptions\cli())->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEqualTo(sprintf('There are %d exceptions:', sizeof($exceptions)) . PHP_EOL . $class . '::' . $method . '():' . PHP_EOL . sprintf('Exception throwed in file %s on line %d:', $file, $line) . PHP_EOL . $value . PHP_EOL . $otherClass . '::' . $otherMethod . '():' . PHP_EOL . sprintf('Exception throwed in file %s on line %d:', $otherFile, $otherLine) . PHP_EOL . $firstOtherValue . PHP_EOL . $secondOtherValue . PHP_EOL)->if($field = new runner\exceptions\cli())->and($field->setTitlePrompt($titlePrompt = new prompt(uniqid())))->and($field->setTitleColorizer($titleColorizer = new colorizer(uniqid(), uniqid())))->and($field->setMethodPrompt($methodPrompt = new prompt(uniqid())))->and($field->setMethodColorizer($methodColorizer = new colorizer(uniqid(), uniqid())))->and($field->setExceptionPrompt($exceptionPrompt = new prompt(uniqid())))->and($field->setExceptionColorizer($exceptionColorizer = new colorizer(uniqid(), uniqid())))->and($field->setLocale($locale = new locale()))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEqualTo($titlePrompt . sprintf($locale->_('%s:'), $titleColorizer->colorize(sprintf($field->getLocale()->__('There is %d exception', 'There are %d exceptions', sizeof($exceptions)), sizeof($exceptions)))) . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($class . '::' . $method . '()')) . PHP_EOL . $exceptionPrompt . sprintf($locale->_('%s:'), $exceptionColorizer->colorize(sprintf($locale->_('Exception throwed in file %s on line %d'), $file, $line))) . PHP_EOL . $exceptionPrompt . $value . PHP_EOL . $methodPrompt . sprintf($locale->_('%s:'), $methodColorizer->colorize($otherClass . '::' . $otherMethod . '()')) . PHP_EOL . $exceptionPrompt . sprintf($locale->_('%s:'), $exceptionColorizer->colorize(sprintf($locale->_('Exception throwed in file %s on line %d'), $otherFile, $otherLine))) . PHP_EOL . $exceptionPrompt . $firstOtherValue . PHP_EOL . $exceptionPrompt . $secondOtherValue . PHP_EOL);
 }
Example #10
0
 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())));
 }
Example #11
0
 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);
 }
Example #12
0
 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);
 }
Example #13
0
 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);
 }
Example #14
0
 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);
 }
Example #15
0
 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))));
 }