Ejemplo n.º 1
0
 public function testAddCall()
 {
     $this->if($adapter = new testedClass())->then->array($adapter->getCalls())->isEmpty()->object($adapter->addCall($method = uniqid(), $args = array(uniqid())))->isIdenticalTo($adapter)->array($adapter->getCalls($method))->isEqualTo(array(1 => $args))->array($adapter->getCalls(strtoupper($method)))->isEqualTo(array(1 => $args));
 }
Ejemplo n.º 2
0
 public function testAddCall()
 {
     $this->if($adapter = new testedClass())->and($adapter->setCalls($calls = new \mock\mageekguy\atoum\test\adapter\calls()))->and($this->calling($calls)->addCall = $calls)->then->object($adapter->addCall($method = uniqid(), $args = array(uniqid())))->isIdenticalTo($adapter)->mock($calls)->call('addCall')->withArguments(new test\adapter\call($method, $args))->once()->object($adapter->addCall($otherMethod = uniqid(), $otherArgs = array(uniqid(), uniqid())))->isIdenticalTo($adapter)->mock($calls)->call('addCall')->withArguments(new test\adapter\call($otherMethod, $otherArgs))->once()->object($adapter->addCall($method, $anotherArgs = array(uniqid())))->isIdenticalTo($adapter)->mock($calls)->call('addCall')->withArguments(new test\adapter\call($method, $anotherArgs))->once()->if($arg = 'foo')->and($arguments = array(&$arg))->then->object($adapter->addCall($method, $arguments))->isIdenticalTo($adapter)->mock($calls)->call('addCall')->withArguments(new test\adapter\call($method, $arguments))->once();
 }