Пример #1
0
 public function test__call()
 {
     $this->if($call = new call\adapter($mockAsserter = new \mock\mageekguy\atoum\asserters\mock(new asserter\generator()), new test\adapter(), uniqid()))->and($mockAsserter->getMockController()->call = $mockAsserter)->then->object($call->call($arg = uniqid()))->isIdenticalTo($mockAsserter)->mock($mockAsserter)->call('call')->withArguments($arg)->once()->if($unknownFunction = uniqid())->then->exception(function () use($call, $unknownFunction) {
         $call->{$unknownFunction}();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Method ' . get_class($mockAsserter) . '::' . $unknownFunction . '() does not exist');
 }
Пример #2
0
 public function testWithAnyArguments()
 {
     $this->if($asserter = new \mock\mageekguy\atoum\asserters\mock(new asserter\generator()))->then->exception(function () use($asserter) {
         $asserter->withArguments(uniqid());
     })->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->withArguments(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Called method is undefined')->if($asserter->call($function = uniqid()))->then->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))->object($asserter->withAnyArguments())->isIdenticalTo($asserter)->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock))->if($asserter->withArguments($arg = uniqid()))->then->object($asserter->getCall())->isEqualTo(new php\call($function, array($arg), $mock))->object($asserter->withAnyArguments())->isIdenticalTo($asserter)->object($asserter->getCall())->isEqualTo(new php\call($function, null, $mock));
 }