public function handleInvocation_should_throw_exception_when_expectation_defines_one() { $expected = new \lang\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 (\lang\XPException $e) { $this->assertEquals($expected, $e); } }