/** * Set the username from the security context by listening on core.request * * @param GetResponseEvent $event */ public function onKernelRequest(GetResponseEvent $event) { $request = $this->container->get('request'); $username = $request->get('_username', 'unknown'); if (null === $this->securityContext) { $this->domainWorkflow->setUsername($username); $this->recordWorkflow->setUsername($username); return; } $token = $this->securityContext->getToken(); if (null !== $token && $this->securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')) { $username = $token->getUsername(); if ($event->getRequest()->get('_username') && 0 != strlen($event->getRequest()->get('_username'))) { $username = $username . ' (' . $_REQUEST['_username'] . ')'; } $this->domainWorkflow->setUsername($username); $this->recordWorkflow->setUsername($username); return; } $this->domainWorkflow->setUsername($username); $this->recordWorkflow->setUsername($username); }
/** * @param $id * @depends testUpdate */ public function testDelete($id) { /** * @type Records $recordObj */ $recordObj = $this->workflow->get($id); $this->workflow->delete($recordObj); try { $this->workflow->get($id); $this->fail('Expected Exception'); } catch (NotFoundException $nf) { $this->assertInstanceOf('\\SysEleven\\PowerDnsBundle\\Lib\\Exceptions\\NotFoundException', $nf); } }