/** * @expectedException \OCA\Gallery\Environment\EnvironmentException */ public function testAfterExceptionWithNonCheckException() { $message = 'fail'; $code = Http::STATUS_NOT_FOUND; $exception = new EnvironmentException($message, $code); $this->middleware->afterException($this->controller, 'checkLinkItemIsValid', $exception); }