Наследование: implements mageekguy\atoum\observable
Пример #1
0
 /**
  * @param runner $runner
  *
  * @return atoum\reports\realtime\cli|null
  */
 protected function getCliReport(runner $runner)
 {
     $cliReport = null;
     foreach ($runner->getReports() as $report) {
         if ($report instanceof \mageekguy\atoum\reports\realtime\cli) {
             $cliReport = $report;
         }
     }
     return $cliReport;
 }
Пример #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);
 }
Пример #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);
 }
Пример #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);
 }
Пример #5
0
 public function testAcceptTestFileExtensions()
 {
     $this->if($runner = new testedClass())->and($runner->setTestDirectoryIterator($directoryIterator = new \mock\mageekguy\atoum\iterators\recursives\directory\factory()))->then->object($runner->acceptTestFileExtensions($testFileExtensions = array(uniqid(), uniqid())))->isIdenticalTo($runner)->mock($directoryIterator)->call('acceptExtensions')->withArguments($testFileExtensions)->once();
 }
Пример #6
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();
 }
Пример #7
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);
 }
Пример #8
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);
 }
Пример #9
0
 public function addToRunner(runner $runner)
 {
     $runner->addExtension($this);
     return $this;
 }
Пример #10
0
 public function addToRunner(\mageekguy\atoum\runner $runner)
 {
     $runner->addExtension($this, $this->configuration);
     return $this;
 }
Пример #11
0
 public function testGetCoverage()
 {
     $this->if($runner = new atoum\runner())->then->object($runner->getCoverage())->isIdenticalTo($runner->getScore()->getCoverage());
 }
Пример #12
0
 public function testHandleEvent()
 {
     $this->if($field = new testedClass(uniqid(), uniqid()))->then->boolean($field->handleEvent(atoum\runner::runStart, new atoum\runner()))->isFalse()->variable($field->getCoverage())->isNull()->boolean($field->handleEvent(atoum\runner::runStop, $runner = new atoum\runner()))->isTrue()->object($field->getCoverage())->isIdenticalTo($runner->getScore()->getCoverage());
 }
Пример #13
0
 public function test__toString()
 {
     $this->if($score = new score())->and($score->setAtoumPath($atoumPath = uniqid())->setAtoumVersion($atoumVersion = uniqid()))->and($runner = new runner())->and($runner->setScore($score))->and($field = new atoum\phing())->and($field->handleEvent(runner::runStop, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(runner::runStart, $runner))->then->castToString($field)->isEqualTo($field->getPrompt() . $field->getColorizer()->colorize(sprintf($field->getLocale()->_("Atoum version: %s \nAtoum path: %s \nAtoum author: %s"), $atoumVersion, $atoumPath, \mageekguy\atoum\author)));
 }
Пример #14
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);
 }
Пример #15
0
 public function testHandleEvent()
 {
     $this->if($score = new score())->and($score->setAtoumPath($atoumPath = uniqid())->setAtoumVersion($atoumVersion = uniqid()))->and($runner = new runner())->and($runner->setScore($score))->and($field = new testedClass())->then->variable($field->getAuthor())->isNull()->variable($field->getPath())->isNull()->variable($field->getVersion())->isNull()->boolean($field->handleEvent(runner::runStart, $runner))->isTrue()->string($field->getAuthor())->isEqualTo(\mageekguy\atoum\author)->string($field->getPath())->isEqualTo($atoumPath)->string($field->getVersion())->isEqualTo($atoumVersion);
 }
Пример #16
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);
 }
Пример #17
0
 public function testBuild()
 {
     $this->if($adapter = new atoum\test\adapter())->and($adapter->extension_loaded = true)->and($adapter->get_class = $class = 'class')->and($runner = new atoum\runner())->and($score = new runner\score())->and($report = $this->newTestedInstance($adapter))->and($runner->setScore($score))->and($testScore = new atoum\test\score())->and($testScore->addPass())->and($test = new \mock\mageekguy\atoum\test())->and($test->getMockController()->getCurrentMethod[1] = $method = 'method')->and($test->getMockController()->getCurrentMethod[2] = $otherMethod = 'otherMethod')->and($test->getMockController()->getCurrentMethod[3] = $thirdMethod = 'thirdMethod')->and($test->setScore($testScore))->and($path = join(DIRECTORY_SEPARATOR, array(__DIR__, 'resources')))->and($testScore->addDuration('foo', $class, $method, $duration = 1))->and($testScore->addUncompletedMethod(uniqid(), $class, $otherMethod, $exitCode = 1, $output = 'output'))->and($testScore->addSkippedMethod(uniqid(), $class, $thirdMethod, $line = rand(1, PHP_INT_MAX), $message = 'message'))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($testScore->addPass())->and($testScore->addPass())->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($score->merge($testScore))->and($report->handleEvent(atoum\runner::runStop, $runner))->then->castToString($report)->isEqualToContentsOfFile(join(DIRECTORY_SEPARATOR, array($path, '1.xml')))->object($dom = new \DomDocument())->boolean($dom->loadXML((string) $report))->isTrue()->boolean($dom->schemaValidate(join(DIRECTORY_SEPARATOR, array($path, 'xunit.xsd'))))->isTrue();
 }
Пример #18
0
 /**
  * @param runner $runner
  * @return $this
  */
 public function addToRunner(\mageekguy\atoum\runner $runner)
 {
     $runner->addExtension($this);
     return $this;
 }
Пример #19
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);
 }
Пример #20
0
 public function testBuild()
 {
     $this->if($adapter = new atoum\test\adapter())->and($adapter->extension_loaded = true)->and($adapter->get_class = $class = 'class')->and($runner = new atoum\runner())->and($score = new runner\score())->and($report = new reports\xunit($adapter))->and($runner->setScore($score))->and($testScore = new atoum\test\score())->and($testScore->addPass())->and($test = new \mock\mageekguy\atoum\test())->and($test->getMockController()->getCurrentMethod[1] = $method = 'method')->and($test->getMockController()->getCurrentMethod[2] = $otherMethod = 'otherMethod')->and($test->getMockController()->getCurrentMethod[3] = $thirdMethod = 'thirdMethod')->and($test->setScore($testScore))->and($path = join(DIRECTORY_SEPARATOR, array(__DIR__, 'xunit', 'resources')))->and($testScore->addDuration(uniqid(), $class, $method, $duration = 1))->and($testScore->addUncompletedMethod(uniqid(), $class, $otherMethod, $exitCode = 1, $output = 'output'))->and($testScore->addSkippedMethod(uniqid(), $class, $thirdMethod, $line = rand(1, PHP_INT_MAX), $message = 'message'))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($testScore->addPass())->and($testScore->addPass())->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($score->merge($testScore))->and($report->handleEvent(atoum\runner::runStop, $runner))->then->castToString($report)->isEqualToContentsOfFile(join(DIRECTORY_SEPARATOR, array($path, '1.xml')))->if($adapter->get_class = $otherClass = 'otherClass')->and($test->setScore($testScore = new atoum\test\score()))->and($test->getMockController()->getCurrentMethod[4] = $otherMethod)->and($test->getMockController()->getCurrentMethod[5] = $thirdMethod)->and($testScore->addFail(uniqid(), $otherClass, $otherMethod, 1, $asserter = 'asserter', $reason = 'reason'))->and($exception = new \mock\Exception())->and($exception->getMockController()->__toString = $trace = 'trace')->and($testScore->addException(uniqid(), $otherClass, $thirdMethod, 1, $exception))->and($score->merge($testScore))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($report->handleEvent(atoum\runner::runStop, $runner))->then->castToString($report)->isEqualToContentsOfFile(join(DIRECTORY_SEPARATOR, array($path, '2.xml')))->if($adapter->get_class = $thirdClassFqn = 'package\\thirdClass')->and($test->setScore($testScore = new atoum\test\score()))->and($test->getMockController()->getCurrentMethod[6] = $fourthMethod = 'fourthMethod')->and($testScore->addError(uniqid(), $thirdClassFqn, $fourthMethod, rand(0, PHP_INT_MAX), $type = E_ERROR, $message))->and($score->merge($testScore))->and($report->handleEvent(atoum\test::afterTestMethod, $test))->and($report->handleEvent(atoum\runner::runStop, $runner))->then->castToString($report)->isEqualToContentsOfFile(join(DIRECTORY_SEPARATOR, array($path, '3.xml')));
 }
Пример #21
0
 public function test__toString()
 {
     $this->if($score = new score())->and($score->setAtoumPath($atoumPath = uniqid())->setAtoumVersion($atoumVersion = uniqid()))->and($runner = new runner())->and($runner->setScore($score))->and($field = new testedClass())->and($field->handleEvent(runner::runStop, $runner))->then->castToString($field)->isEmpty()->if($field->handleEvent(runner::runStart, $runner))->then->castToString($field)->isEqualTo($field->getPrompt() . $field->getColorizer()->colorize(sprintf($field->getLocale()->_('atoum version %s by %s (%s)'), $atoumVersion, \mageekguy\atoum\author, $atoumPath)) . PHP_EOL);
 }