public function testWillNotProceedExecuteOnWriteAndCrash() { $object = new \stdClass(); $this->methodInvocation->expects($this->never())->method('proceed')->will($this->returnValue('done')); $this->methodInvocation->expects($this->any())->method('getThis')->will($this->returnValue($object)); $this->methodInvocation->expects($this->any())->method('getMethod')->will($this->returnValue(new ReflectionMethod(__CLASS__, __FUNCTION__))); foreach ($this->callables as $callable) { $callable->expects($this->any())->method('__invoke')->with($object, __CLASS__)->will($this->throwException(new \Exception())); } $aspect = new PostConstructAspect(...$this->callables); $this->setExpectedException(\Exception::class); $aspect->postConstruct($this->methodInvocation); }