Example #1
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 #2
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 #3
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 #4
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 #5
0
 public function test__toString()
 {
     $this->if($field = new testedClass())->and($field->setAdapter($adapter = new atoum\test\adapter()))->and($adapter->system = function () {
     })->then->castToString($field)->isEmpty()->adapter($adapter)->call('system')->never()->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getErrors = array())->and($runner = new atoum\runner())->and($runner->setScore($score))->and($field->handleEvent(atoum\runner::runStart, $runner))->then->castToString($field)->isEmpty()->adapter($adapter)->call('system')->never()->if($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEmpty()->adapter($adapter)->call('system')->never()->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($field->handleEvent(atoum\runner::runStop, $runner))->then->castToString($field)->isEmpty()->adapter($adapter)->call('system')->withArguments('mvim --remote-silent +' . $line . ' ' . $file)->once()->adapter($adapter)->call('system')->withArguments('mvim --remote-silent +' . $otherLine . ' ' . $otherFile)->once();
 }
Example #6
0
 public function testHandleEvent()
 {
     $this->if($score = new \mock\mageekguy\atoum\runner\score())->and($score->getMockController()->getAssertionNumber = $assertionNumber = rand(1, PHP_INT_MAX))->and($score->getMockController()->getFailNumber = $failNumber = rand(1, PHP_INT_MAX))->and($score->getMockController()->getErrorNumber = $errorNumber = rand(1, PHP_INT_MAX))->and($score->getMockController()->getExceptionNumber = $exceptionNumber = 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($runner->getMockController()->getTestMethodNumber = $testMethodNumber = rand(1, PHP_INT_MAX))->and($field = new runner\result\cli())->then->boolean($field->handleEvent(atoum\runner::runStart, $runner))->isFalse()->variable($field->getTestNumber())->isNull()->variable($field->getTestMethodNumber())->isNull()->variable($field->getAssertionNumber())->isNull()->variable($field->getFailNumber())->isNull()->variable($field->getErrorNumber())->isNull()->variable($field->getExceptionNumber())->isNull()->boolean($field->handleEvent(atoum\runner::runStop, $runner))->isTrue()->integer($field->getTestNumber())->isEqualTo($testNumber)->integer($field->getTestMethodNumber())->isEqualTo($testMethodNumber)->integer($field->getAssertionNumber())->isEqualTo($assertionNumber)->integer($field->getFailNumber())->isEqualTo($failNumber)->integer($field->getErrorNumber())->isEqualTo($errorNumber)->integer($field->getExceptionNumber())->isEqualTo($exceptionNumber);
 }
Example #7
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 #8
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);
 }