public function handleInvocation_should_throw_exception_when_expectation_defines_one() { $expected = new XPException('foo'); $myExpectation = new Expectation('foo'); $myExpectation->setException($expected); $expectationsList = new ExpectationList(); $expectationsList->add($myExpectation); $this->expectationMap->put('foo', $expectationsList); try { $this->sut->handleInvocation('foo', NULL); $this->fail('Exception not thrown.', NULL, $expect); } catch (XPException $e) { $this->assertEquals($expected, $e); } }