Ejemplo n.º 1
0
 public function testSetTestFactory()
 {
     $this->if($runner = new testedClass())->then->variable($runner->getTestFactory())->isCallable->object($runner->setTestFactory())->isIdenticalTo($runner)->object($runner->getTestFactory())->isCallable->if($factory = function () {
     })->then->object($runner->setTestFactory($factory))->isIdenticalTo($runner)->object($runner->getTestFactory())->isCallable->given($test = new \mock\mageekguy\atoum\test())->and($generator = new \mock\mageekguy\atoum\test\mock\generator($test))->and($test->setMockGenerator($generator))->if($runner->disallowUsageOfUndefinedMethodInMock())->and($runner->setTestFactory(function () use($test) {
         return $test;
     }))->and($factory = $runner->getTestFactory())->then->object($factory('mock\\mageekguy\\atoum\\test'))->isIdenticalTo($test)->mock($generator)->call('disallowUndefinedMethodUsage')->once->if($this->resetMock($generator))->if($runner->allowUsageOfUndefinedMethodInMock())->then->object($factory('mock\\mageekguy\\atoum\\test'))->isIdenticalTo($test)->mock($generator)->call('disallowUndefinedMethodUsage')->never;
 }
Ejemplo n.º 2
0
 public function test__toString()
 {
     $this->if($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($field = new test\event\phing())->and($count = rand(1, PHP_INT_MAX))->and($test->getMockController()->count = function () use($count) {
         return $count;
     })->then->castToString($field)->isEmpty()->if($field->handleEvent(atoum\test::runStart, $test))->then->castToString($field)->isEqualTo('[')->if($field->handleEvent(atoum\test::beforeSetUp, $test))->then->castToString($field)->isEqualTo('')->if($field->handleEvent(atoum\test::afterSetUp, $test))->then->castToString($field)->isEqualTo('')->if($field->handleEvent(atoum\test::beforeTestMethod, $test))->then->castToString($field)->isEqualTo('')->if($field->handleEvent(atoum\test::fail, $test))->then->castToString($field)->isEqualTo('F')->if($field->handleEvent(atoum\test::error, $test))->then->castToString($field)->isEqualTo('e')->if($field->handleEvent(atoum\test::exception, $test))->then->castToString($field)->isEqualTo('E')->if($field->handleEvent(atoum\test::success, $test))->then->castToString($field)->isEqualTo('S')->if($field->handleEvent(atoum\test::uncompleted, $test))->then->castToString($field)->isEqualTo('U')->if($field->handleEvent(atoum\test::afterTestMethod, $test))->then->castToString($field)->isEqualTo('')->if($field->handleEvent(atoum\test::beforeTearDown, $test))->then->castToString($field)->isEqualTo('')->if($field->handleEvent(atoum\test::afterTearDown, $test))->then->castToString($field)->isEqualTo('')->if($field->handleEvent(atoum\test::runStop, $test))->then->castToString($field)->isEqualTo('] ');
 }