Пример #1
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);
 }
Пример #2
0
 public function testSetAtoumPath()
 {
     $this->if($score = new testedClass())->then->object($score->setAtoumPath($path = uniqid()))->isIdenticalTo($score)->string($score->getAtoumPath())->isEqualTo($path)->exception(function () use($score) {
         $score->setAtoumPath(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\runtime')->hasMessage('Path of atoum is already set')->object($score->reset()->setAtoumPath($path = rand(1, PHP_INT_MAX)))->isIdenticalTo($score)->string($score->getAtoumPath())->isEqualTo((string) $path);
 }
Пример #3
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)));
 }
Пример #4
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);
 }