/** * {@inheritdoc} */ public function execute($request, $catchInteractive = false) { $action = null; try { $this->extensions->onPreExecute($request); if (false == ($action = $this->findActionSupported($request))) { throw RequestNotSupportedException::create($request); } $this->extensions->onExecute($request, $action); $action->execute($request); $this->extensions->onPostExecute($request, $action); } catch (InteractiveRequestInterface $interactiveRequest) { $interactiveRequest = $this->extensions->onInteractiveRequest($interactiveRequest, $request, $action) ?: $interactiveRequest; if ($catchInteractive) { return $interactiveRequest; } throw $interactiveRequest; } catch (\Exception $e) { $this->extensions->onException($e, $request, $action); throw $e; } }
/** * @test */ public function shouldCreateWithObjectRequest() { $exception = RequestNotSupportedException::create(new \stdClass()); $this->assertInstanceOf('Payum\\Exception\\RequestNotSupportedException', $exception); $this->assertEquals('Request stdClass is not supported.', $exception->getMessage()); }