/** * {@inheritdoc} * * @see \mageekguy\atoum\asserters\adapter::__get() */ public function __get($property) { switch (strtolower($property)) { case 'with': return $this->{$property}(); default: return parent::__get($property); } }
public function testNever() { $this->if($asserter = new sut($generator = new asserter\generator()))->then->exception(function () use($asserter) { $asserter->never(); })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Mock is undefined')->if($asserter->setWith($mock = new \mock\mageekguy\atoum\tests\units\asserters\dummy()))->then->exception(function () use($asserter) { $asserter->never(); })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Call is undefined')->if($asserter->call('foo'))->then->object($asserter->never())->isIdenticalTo($asserter)->if($call = new test\adapter\call('foo', null, new decorators\addClass($mock)))->and($mock->foo($usedArg = uniqid()))->then->exception(function () use($asserter) { $asserter->never(); })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($usedArg)))->if($mock->getMockController()->resetCalls())->and($asserter->withArguments($arg = uniqid()))->then->object($asserter->never())->isIdenticalTo($asserter)->if($mock->foo($arg))->then->exception(function () use($asserter) { $asserter->never(); })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is called 1 time instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($arg)))->if($mock->foo($arg))->then->exception(function () use($asserter) { $asserter->never(); })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage(sprintf($generator->getLocale()->_('%s is called 2 times instead of 0'), $asserter->getCall()) . PHP_EOL . '[1] ' . $call->setArguments(array($arg)) . PHP_EOL . '[2] ' . $call->setArguments(array($arg)))->if($mock->foo($arg))->then->exception(function () use($asserter, &$message) { $asserter->never($message = uniqid()); })->isInstanceOf('mageekguy\\atoum\\asserter\\exception')->hasMessage($message)->if($asserter->withArguments(uniqid()))->then->object($asserter->never())->isIdenticalTo($asserter); }