Example #1
0
 public function testWithAnyArguments()
 {
     $this->if($asserter = new \mock\mageekguy\atoum\asserters\adapter(new asserter\generator()))->and($asserter->getMockController()->atLeastOnce = function () {
     })->then->exception(function () use($asserter) {
         $asserter->withArguments(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Adapter is undefined')->if($asserter->setWith($adapter = new test\adapter()))->then->exception(function () use($asserter) {
         $asserter->withArguments(uniqid());
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic')->hasMessage('Called function is undefined')->if($asserter->call($function = uniqid()))->then->object($asserter->getCall())->isEqualTo(new php\call($function))->object($asserter->withAnyArguments())->isIdenticalTo($asserter)->object($asserter->getCall())->isEqualTo(new php\call($function))->if($asserter->withArguments($arg = uniqid()))->then->object($asserter->getCall())->isEqualTo(new php\call($function, array($arg)))->object($asserter->withAnyArguments())->isIdenticalTo($asserter)->object($asserter->getCall())->isEqualTo(new php\call($function));
 }
Example #2
0
 public function test__call()
 {
     $this->if($call = new call\mock($adapterAsserter = new \mock\mageekguy\atoum\asserters\adapter(new asserter\generator()), new \mock\dummy(), uniqid()))->and($adapterAsserter->getMockController()->call = $adapterAsserter)->then->object($call->call($arg = uniqid()))->isIdenticalTo($adapterAsserter)->mock($adapterAsserter)->call('call')->withArguments($arg)->once()->if($unknownMethod = uniqid())->then->exception(function () use($call, $unknownMethod) {
         $call->{$unknownMethod}();
     })->isInstanceOf('mageekguy\\atoum\\exceptions\\logic\\invalidArgument')->hasMessage('Method ' . get_class($adapterAsserter) . '::' . $unknownMethod . '() does not exist');
 }