public function getNext_SameExpectationTwice_whenRepeatIs2() { $expect = new Expectation('method'); $expect->setRepeat(2); $this->sut->add($expect); $this->assertEquals($expect, $this->sut->getNext(array())); $this->assertEquals($expect, $this->sut->getNext(array())); $this->assertNull($this->sut->getNext(array())); }
public function handleInvocation_ExpectationRepeatedTwice_returnExpectationsReturnValueTwice() { $myExpectation = new Expectation('foo'); $myExpectation->setReturn('foobar'); $myExpectation->setRepeat(2); $expectationsList = new ExpectationList(); $expectationsList->add($myExpectation); $this->expectationMap->put('foo', $expectationsList); $this->assertEquals($myExpectation->getReturn(), $this->sut->handleInvocation('foo', NULL)); $this->assertEquals($myExpectation->getReturn(), $this->sut->handleInvocation('foo', NULL)); $this->assertNull($this->sut->handleInvocation('foo', NULL)); }