public function decorate(call $call) { $string = ''; $function = $call->getFunction(); if ($function !== null) { $string = $function . '('; $arguments = $call->getArguments(); if ($arguments === null) { $string .= '*'; } else { $string .= $this->argumentsDecorator->decorate($call->getArguments()); } $string .= ')'; } return $string; }
public function testHasAfterIdenticalTo() { $this->if($calls = new testedClass())->then->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()->if($calls[] = $call1 = new adapter\call(uniqid()))->then->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), rand(1, PHP_INT_MAX)))->isFalse()->boolean($calls->hasAfterIdenticalTo(new adapter\call($call1), 0))->isFalse()->boolean($calls->hasAfterIdenticalTo(new adapter\call($call1), 1))->isFalse()->boolean($calls->hasAfterIdenticalTo(new adapter\call($call1), rand(2, PHP_INT_MAX)))->isFalse()->if($calls[] = $call2 = new adapter\call(uniqid(), array()))->then->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), 1))->isFalse()->boolean($calls->hasAfterIdenticalTo($call1, 1))->isFalse()->boolean($calls->hasAfterIdenticalTo($call1, 2))->isFalse()->boolean($afterCalls = $calls->hasAfterIdenticalTo($call2, 1))->isTrue()->boolean($calls->hasAfterIdenticalTo($call2, 2))->isFalse()->if($calls[] = $call3 = new adapter\call(uniqid(), array($object = new \mock\object())))->if($calls[] = $call4 = new adapter\call($call3->getFunction(), array(clone $object)))->and($calls[] = $call5 = new adapter\call(uniqid(), array()))->then->boolean($calls->hasAfterIdenticalTo(new adapter\call(uniqid()), 1))->isFalse()->boolean($calls->hasAfterIdenticalTo($call1, 1))->isFalse()->boolean($calls->hasAfterIdenticalTo($call1, 2))->isFalse()->boolean($afterCalls = $calls->hasAfterIdenticalTo($call2, 1))->isTrue()->boolean($calls->hasAfterIdenticalTo($call2, 2))->isFalse()->boolean($afterCalls = $calls->hasAfterIdenticalTo($call3, 1))->isTrue()->boolean($afterCalls = $calls->hasAfterIdenticalTo($call3, 3))->isFalse()->boolean($afterCalls = $calls->hasAfterIdenticalTo($call4, 1))->isTrue(); }
protected static function getKey(adapter\call $call) { return strtolower($call->getFunction()); }
public function getCalls(test\adapter\call $call = null, $identical = false) { if ($call !== null) { $this->checkMethod($call->getFunction()); } return parent::getCalls($call, $identical); }
public function testSetFunction() { $this->if($call = new testedClass())->then->object($call->setFunction($function = uniqid()))->isIdenticalTo($call)->string($call->getFunction())->isEqualTo($function)->object($call->setFunction('foo'))->isIdenticalTo($call)->string($call->getFunction())->isEqualTo('foo')->object($call->setFunction('FOo'))->isIdenticalTo($call)->string($call->getFunction())->isEqualTo('FOo'); }