public function handleEvent($event, atoum\observable $observable) { if (parent::handleEvent($event, $observable) === false) { return false; } $this->testedClassName = $observable->getTestedClassName(); return parent::handleEvent($event, $observable); }
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\cli())->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::runStop, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::beforeSetUp, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::afterSetUp, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::beforeTestMethod, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::fail, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::error, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::exception, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::success, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::afterTestMethod, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::beforeTearDown, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::afterTearDown, $test))->then->castToString($defaultField)->isEqualTo('There is currently no test running.' . PHP_EOL)->if($defaultField->handleEvent(atoum\test::runStart, $test))->then->castToString($defaultField)->isEqualTo(sprintf('%s...', $test->getClass()) . PHP_EOL)->if($customField = new test\run\cli())->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.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::runStop, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::beforeSetUp, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::afterSetUp, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::beforeTestMethod, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::fail, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::error, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::exception, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::success, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::afterTestMethod, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::beforeTearDown, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::afterTearDown, $test))->then->castToString($customField)->isEqualTo($prompt . $colorizer->colorize($locale->_('There is currently no test running.')) . PHP_EOL)->if($customField->handleEvent(atoum\test::runStart, $test))->then->castToString($customField)->isEqualTo($prompt . sprintf($locale->_('%s...'), $colorizer->colorize($test->getClass())) . PHP_EOL); }