/** * @test */ public function shouldDoNothingIfActionNotImplementsGenericTokenFactoryAwareInterfaceOnPostExecute() { $tokenFactory = $this->createGenericTokenFactoryMock(); $extension = new GenericTokenFactoryExtension($tokenFactory); $action = $this->createActionMock(); $context = new Context($this->createGatewayMock(), new \stdClass(), array()); $context->setAction($action); $extension->onPostExecute($context); }
/** * @test */ public function shouldDoNothingOnPreExecute() { $logger = $this->createLoggerMock(); $extension = new LoggerExtension($logger); $action = new LoggerAwareAction(); $context = new Context($this->createGatewayMock(), new \stdClass(), array()); $context->setAction($action); $extension->onPreExecute($context); $this->assertNull($action->logger); }
/** * @test */ public function shouldLogExceptionWhenSetOnPostExecute() { $action = new FooAction(); $logger = $this->createLoggerMock(); $logger->expects($this->at(0))->method('debug')->with('[Payum] 1# FooAction::execute(string) throws exception LogicException'); $extension = new LogExecutedActionsExtension($logger); $context = new Context($this->createGatewayMock(), 'string', array()); $context->setAction($action); $context->setException(new \LogicException()); $extension->onPostExecute($context); }