/** * Checking request and response and decide whether we need a redirect * * @param FilterResponseEvent $event */ public function onResponse(FilterResponseEvent $event) { $request = $event->getRequest(); $response = $event->getResponse(); if ($request->get(self::HASH_NAVIGATION_HEADER) || $request->headers->get(self::HASH_NAVIGATION_HEADER)) { $location = ''; $isFullRedirect = false; if ($response->isRedirect()) { $location = $response->headers->get('location'); if ($request->attributes->get('_fullRedirect') || !is_object($this->security->getToken())) { $isFullRedirect = true; } } if ($response->isNotFound() || $response->getStatusCode() == 503 && !$this->isDebug) { $location = $request->getUri(); $isFullRedirect = true; } if ($location) { $response = $this->templating->renderResponse('OroNavigationBundle:HashNav:redirect.html.twig', array('full_redirect' => $isFullRedirect, 'location' => $location)); } // disable cache for ajax navigation pages and change content type to json $response->headers->set('Content-Type', 'application/json'); $response->headers->addCacheControlDirective('no-cache', true); $response->headers->addCacheControlDirective('max-age', 0); $response->headers->addCacheControlDirective('must-revalidate', true); $response->headers->addCacheControlDirective('no-store', true); $event->setResponse($response); } }
/** * Display association grids * * @param Request $request the request * @param integer $id the product id (owner) * * @AclAncestor("pim_enrich_associations_view") * * @return Response */ public function associationsAction(Request $request, $id) { $product = $this->findProductOr404($id); $this->productManager->ensureAllAssociationTypes($product); $associationTypes = $this->doctrine->getRepository('PimCatalogBundle:AssociationType')->findAll(); return $this->templating->renderResponse('PimEnrichBundle:Association:_associations.html.twig', array('product' => $product, 'associationTypes' => $associationTypes, 'dataLocale' => $request->get('dataLocale', null))); }
public function indexAction(Request $request, $configurationId) { $configuration = $this->getConfigurationOr404($configurationId); $pagination = $this->createPagination($configuration, $request); $reports = $this->reportManager->getJobReportsByConfiguration($configuration, $pagination->getOffset(), $pagination->getPerPage()); return $this->templating->renderResponse('AurejaJobQueueBundle:JobReport:index.html.twig', ['configuration' => $this->getConfigurationOr404($configurationId), 'pagination' => $pagination, 'reports' => $reports]); }
/** * @param GetResponseEvent $event */ public function onCoreRequest(GetResponseEvent $event) { if (HttpKernel::MASTER_REQUEST != $event->getRequestType()) { return; } $token = $this->securityContext->getToken(); if (!$token) { return; } if (!$token instanceof UsernamePasswordToken) { return; } $key = $this->helper->getSessionKey($this->securityContext->getToken()); $request = $event->getRequest(); $session = $event->getRequest()->getSession(); $user = $this->securityContext->getToken()->getUser(); if (!$session->has($key)) { return; } if ($session->get($key) === true) { return; } $state = 'init'; if ($request->getMethod() == 'POST') { if ($this->helper->checkCode($user, $request->get('_code')) == true) { $session->set($key, true); return; } $state = 'error'; } $event->setResponse($this->templating->renderResponse('SonataUserBundle:Admin:Security/two_step_form.html.twig', array('state' => $state))); }
public function loginAction(Request $request) { $form = $this->formFactory->create(LoginType::class); if ($error = $this->getAuthenticationError($request)) { $form->addError(new FormError($error->getMessage())); } return $this->templating->renderResponse('Security/login.html.twig', ['form' => $form->createView()]); }
public function details($token, $requestIndex) { $this->profiler->disable(); $profile = $this->profiler->loadProfile($token); $logs = $profile->getCollector('contentful')->getLogs(); $logEntry = $logs[$requestIndex]; return $this->templating->renderResponse('@Contentful/Collector/details.html.twig', ['requestIndex' => $requestIndex, 'entry' => $logEntry]); }
public function modalAction(Request $request) { $image = null; if (null !== ($filename = $request->get('filename', null))) { $image = $this->imageManager->findByFilename($filename); } return $this->templating->renderResponse('SilvestraMediaBundle:Form:modal.html.twig', array('image' => $image)); }
/** * Displays completeness for a product * * @param int $id * * @return Response */ public function completenessAction($id) { $product = $this->productManager->getProductRepository()->getFullProduct($id); $channels = $this->channelManager->getFullChannels(); $locales = $this->userContext->getUserLocales(); $completenesses = $this->completenessManager->getProductCompleteness($product, $channels, $locales, $this->userContext->getCurrentLocale()->getCode()); return $this->templating->renderResponse('PimEnrichBundle:Completeness:_completeness.html.twig', array('product' => $product, 'channels' => $channels, 'locales' => $locales, 'completenesses' => $completenesses)); }
/** * @param JobEvent $jobEvent */ public function onJobCreated(JobEvent $jobEvent) { $job = $jobEvent->getJob(); // Notification message to User $this->jobBoardMailer->sendMessage(sprintf('The job %s has been Sent', $job->getTitle()), '*****@*****.**', $job->getEmail(), $this->templating->renderResponse('Email/user.html.twig', array('job' => $job))); // Notification message to Job-Board Moderator $this->jobBoardMailer->sendMessage(sprintf('The job %s has been created', $job->getTitle()), '*****@*****.**', '*****@*****.**', $this->templating->renderResponse('Email/moderator.html.twig', array('job' => $job))); }
public function createAction() { $productFromAdmin = new ProductFromAdmin(); $productData = Product::instantiateFromAdmin($productFromAdmin); // $productData = new ProductFromAdmin(); // $productData->name = 'Wat NU?'; return $this->templateEngine->renderResponse('AppBundle:admin:productStore.html.twig', array('product' => $productData)); }
/** * {@inheritdoc} */ public function render(ReportInterface $report, Data $data) { if (null !== $data->getData()) { $data = array('report' => $report, 'values' => $data->getData(), 'labels' => $data->getLabels(), 'fields' => array_keys($data->getData())); $rendererConfiguration = $report->getRendererConfiguration(); return $this->templating->renderResponse($rendererConfiguration["template"], array('data' => $data, 'configuration' => $rendererConfiguration)); } return $this->templating->renderResponse("SyliusReportBundle::noDataTemplate.html.twig", array('report' => $report)); }
public function itemAction($id) { try { $item = $this->manager->getItem($id); } catch (NotFoundException $e) { throw new NotFoundHttpException($e->getMessage()); } return $this->templating->renderResponse($this->templateItem, ['item' => $item]); }
/** * @param Request $request * * @return Response */ public function indexAction(Request $request) { $channelCode = $request->query->get('channel'); /** @var ChannelInterface $channel */ $channel = $this->findChannelByCodeOrFindFirst($channelCode); if (null === $channel) { return new RedirectResponse($this->router->generate('sylius_admin_channel_create')); } $statistics = $this->statisticsProvider->getStatisticsForChannel($channel); return $this->templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig', ['statistics' => $statistics, 'channel' => $channel]); }
public function registerForm(Request $request) { if ($this->pageStack->isLoggedIn()) { return $this->templating->renderResponse('JarvesBundle:User:logout.html.twig'); } $user = new User(); $form = $this->formFactory->createBuilder()->setData($user)->add('email', EmailType::class)->add('password', PasswordType::class)->add('save', SubmitType::class, array('label' => 'Register'))->getForm(); $form->handleRequest($request); if ($form->isSubmitted() && $form->isValid()) { } return $this->templating->renderResponse('JarvesBundle:User:register.html.twig', ['form' => $form->createView()]); }
/** * {@inheritdoc} */ public function renderResponse($data = null) { if (false === is_array($data)) { throw new \InvalidArgumentException('Data should be an array'); } if (false === array_key_exists('template', $data)) { throw new \InvalidArgumentException('Data should contain a "template" key'); } if (false === array_key_exists('parameters', $data)) { throw new \InvalidArgumentException('Data should contain a "parameters" key'); } return $this->templating->renderResponse($data['template'], $data['parameters']); }
public function indexAction(Request $request) { $site = $this->siteManager->find(); if (null === $site) { $site = $this->siteManager->create(); } $form = $this->formFactory->create($site); if ($this->formHandler->process($request, $form)) { $this->formHandler->onSuccess($request->getLocale(), $site); return new RedirectResponse($this->router->generate('silvestra_site')); } return $this->templating->renderResponse('SilvestraSiteBundle:Site:index.html.twig', array('form' => $form->createView(), 'page_header' => $this->translator->trans('site', array(), 'SilvestraSite'))); }
/** * List comments made on a product * * @param Request $request * @param integer|string $id * * @AclAncestor("pim_enrich_product_comment") * * @return \Symfony\Component\HttpFoundation\Response */ public function listCommentsAction(Request $request, $id) { $product = $this->findProductOr404($id); $comment = $this->commentBuilder->buildComment($product, $this->getUser()); $createForm = $this->formFactory->create('pim_comment_comment', $comment); $comments = $this->commentManager->getComments($product); $replyForms = []; foreach ($comments as $comment) { $reply = $this->commentBuilder->buildReply($comment, $this->getUser()); $replyForm = $this->formFactory->create('pim_comment_comment', $reply, ['is_reply' => true]); $replyForms[$comment->getId()] = $replyForm->createView(); } return $this->templating->renderResponse('PimCommentBundle:Comment:_commentList.html.twig', ['createForm' => $createForm->createView(), 'replyForms' => $replyForms, 'comments' => $comments]); }
public function changePasswordAction(Request $request) { $this->changePasswordForm->handleRequest($request); if ($this->changePasswordForm->isValid()) { $user = $this->tokenStorage->getToken()->getUser(); $formData = $this->changePasswordForm->getData(); $this->eventDispatcher->dispatch(AdminSecurityEvents::CHANGE_PASSWORD, new ChangePasswordEvent($user, $formData['plainPassword'])); $request->getSession()->invalidate(); $this->tokenStorage->setToken(null); $request->getSession()->getFlashBag()->set('success', 'admin.change_password_message.success'); return new RedirectResponse($this->router->generate('fsi_admin_security_user_login')); } return $this->templating->renderResponse($this->changePasswordActionTemplate, array('form' => $this->changePasswordForm->createView())); }
/** * @param \FSi\Bundle\AdminBundle\Admin\Element $element * @param \Symfony\Component\HttpFoundation\Request $request * @param string $route * @return null|\Symfony\Component\HttpFoundation\Response */ protected function handleRequest(Element $element, Request $request, $route) { $context = $this->contextManager->createContext($route, $element); if (!$context instanceof ContextInterface) { throw new NotFoundHttpException(sprintf('Cant find context builder that supports element with id "%s"', $element->getId())); } if (($response = $context->handleRequest($request)) !== null) { return $response; } if (!isset($this->template) && !$context->hasTemplateName()) { throw new ContextException(sprintf("Context %s did not returned any response and controller %s has no template", get_class($context), __CLASS__)); } return $this->templating->renderResponse($context->hasTemplateName() ? $context->getTemplateName() : $this->template, $context->getData()); }
public function templateAction(Request $request, $template, $maxAge = null, $sharedAge = null, $private = null, $metaTables = null, $metaTableConstants = null, $metaEntities = null, $metaResetInterval = null) { /** @var \DateTime $lastmod */ $lastmod = null; /** @var $response \Symfony\Component\HttpFoundation\Response */ $response = null; if ($metaTables || $metaTableConstants || $metaEntities) { $lastmodHelper = new LastmodHelper(); if ($metaTables) { $lastmodHelper->setTables($metaTables); } if ($metaTableConstants) { $lastmodHelper->setTableIdConstants($metaTableConstants); } if ($metaEntities) { $lastmodHelper->setEntities($metaEntities); } if ($metaResetInterval) { $lastmodHelper->setResetInterval($metaResetInterval); } $lastmod = $lastmodHelper->calculateLastModified($this->metaQueryFactory); } if (!$this->debug && $lastmod) { $response = new Response(); $response->setLastModified($lastmod); if (!$response->isNotModified($request)) { $response = null; } } if (!$response) { $response = $this->templating->renderResponse($template); if ($lastmod) { $response->setLastModified($lastmod); } } if (null !== $maxAge) { $response->setMaxAge($maxAge); } if (null !== $sharedAge) { $response->setSharedMaxAge($sharedAge); } if ($private) { $response->setPrivate(); } elseif ($private === false || null === $private && ($maxAge || $sharedAge)) { $response->setPublic($private); } return $response; }
/** * @param GetResponseForControllerResultEvent $event */ public function onKernelView(GetResponseForControllerResultEvent $event) { $request = $event->getRequest(); $attributes = $request->attributes; $result = $event->getControllerResult(); if (!is_array($this->controller) || !is_array($result)) { return; } $view = $attributes->get($this->viewAttribute, null, true); if (is_array($view)) { $action = basename($this->controller[1], 'Action'); if (array_key_exists($action, $view)) { $view = $view[$action]; } elseif (!empty($view['_default'])) { $view = $view['_default']; } } if ((empty($view) || !is_string($view)) && $this->autoGuess) { $view = $this->guessViewName(); } if (!$this->engine->exists($view)) { return; } if ($view) { $event->setResponse($this->engine->renderResponse($view, $result)); } }
/** * {@inheritdoc} */ public function sendbank(OrderInterface $order) { $params = array('bank' => $this->getCode(), 'reference' => $order->getReference(), 'check' => $this->generateUrlCheck($order)); $cmdLineParameters = array('merchant_id' => $this->getOption('merchant_id'), 'merchant_country' => $this->getOption('merchant_country'), 'pathfile' => $this->getOption('pathfile'), 'language' => $this->getLanguage($order), 'payment_means' => $this->getOption('payment_means'), 'header_flag' => $this->getOption('header_flag'), 'capture_day' => $this->getOption('capture_day'), 'capture_mode' => $this->getOption('capture_mode'), 'bgcolor' => $this->getOption('bgcolor'), 'block_align' => $this->getOption('block_align'), 'block_order' => $this->getOption('block_order'), 'textcolor' => $this->getOption('textcolor'), 'normal_return_logo' => $this->getOption('normal_return_logo'), 'cancel_return_logo' => $this->getOption('cancel_return_logo'), 'submit_logo' => $this->getOption('submit_logo'), 'logo_id' => $this->getOption('logo_id'), 'logo_id2' => $this->getOption('logo_id2'), 'advert' => $this->getOption('advert'), 'background_id' => $this->getOption('background_id'), 'templatefile' => $this->getOption('templatefile'), 'amount' => $this->getAmount($order->getTotalInc(), $order->getCurrency()->getLabel()), 'currency_code' => $this->getCurrencyCode($order->getCurrency()->getLabel()), 'transaction_id' => $this->transactionGenerator->generate($order), 'normal_return_url' => $this->router->generate($this->getOption('url_return_ok'), $params, true), 'cancel_return_url' => $this->router->generate($this->getOption('url_return_ko'), $params, true), 'automatic_response_url' => $this->router->generate($this->getOption('url_callback'), $params, true), 'caddie' => 'mon_caddie', 'customer_id' => $order->getCustomer()->getId(), 'customer_email' => $order->getCustomer()->getEmail(), 'customer_ip_address' => '', 'data' => $this->getOption('data'), 'return_context' => '', 'target' => '', 'order_id' => $order->getReference()); // clean parameters $cmdLineOptions = array(); foreach ($cmdLineParameters as $option => $value) { $cmdLineOptions[] = sprintf('%s=%s', $option, $this->encodeString($value)); } $cmd = sprintf('cd %s && %s %s', $this->getOption('base_folder'), $this->getOption('request_command'), join(' ', $cmdLineOptions)); $this->logger->debug(sprintf('Running command : %s', $cmd)); $process = new Process($cmd); $process->run(); if (!$process->isSuccessful()) { throw new \RuntimeException(sprintf('Error %d when executing Scellius command: "%s".', $process->getExitCode(), trim($process->getErrorOutput()))); } //sortie de la fonction : $result=!code!error!buffer! // - code=0 : la fonction génère une page html contenue dans la variable buffer // - code=-1 : La fonction retourne un message d'erreur dans la variable error $data = explode("!", $process->getOutput()); if (count($data) != 5) { throw new \RuntimeException('Invalid data count'); } if ($data[1] == 0) { $scellius = array('valid' => true, 'content' => $data[3]); } else { $scellius = array('valid' => false, 'content' => $data[2]); } return $this->templating->renderResponse($this->getOption('template'), array('order' => $order, 'scellius' => $scellius, 'debug' => $this->debug, 'parameters' => $cmdLineParameters)); }
/** * Edit a job instance * * @param Request $request * @param int $id * * @return Response */ public function editAction(Request $request, $id) { try { $jobInstance = $this->getJobInstance($id); } catch (NotFoundHttpException $e) { $this->request->getSession()->getFlashBag()->add('error', new Message($e->getMessage())); return $this->redirectToIndexView(); } $this->eventDispatcher->dispatch(JobProfileEvents::PRE_EDIT, new GenericEvent($jobInstance)); $form = $this->formFactory->create($this->jobInstanceFormType, $jobInstance, ['method' => 'PATCH']); if ($request->isMethod('PATCH')) { $form->handleRequest($request); if ($form->isValid()) { $this->entityManager->persist($jobInstance); $this->entityManager->flush(); $this->request->getSession()->getFlashBag()->add('success', new Message(sprintf('flash.%s.updated', $this->getJobType()))); return $this->redirectToShowView($jobInstance->getId()); } } $this->eventDispatcher->dispatch(JobProfileEvents::POST_EDIT, new GenericEvent($jobInstance)); $job = $this->jobRegistry->get($jobInstance->getJobName()); $errors = []; $accessor = PropertyAccess::createPropertyAccessorBuilder()->getPropertyAccessor(); foreach ($form->getErrors() as $error) { if (0 === strpos($error->getCause()->getPropertyPath(), 'children[parameters].children[filters].data')) { $propertyPath = substr($error->getCause()->getPropertyPath(), strlen('children[parameters].children[filters].data')); $accessor->setValue($errors, $propertyPath, $error->getMessage()); } } return $this->templating->renderResponse($this->jobTemplateProvider->getEditTemplate($jobInstance), ['jobInstance' => $jobInstance, 'job' => $job, 'form' => $form->createView(), 'errors' => $errors]); }
/** * @param string $operationAlias * * @AclAncestor("pim_enrich_mass_edit") * * @throws NotFoundResourceException * * @return \Symfony\Component\HttpFoundation\Response */ public function performAction($operationAlias) { $gridName = $this->request->get('gridName'); $operation = $this->operationRegistry->get($operationAlias); $itemsName = $operation->getItemsName(); $productCount = $this->request->get('objectsCount'); $form = $this->massEditFormResolver->getConfigurationForm($operationAlias); $form->remove('operationAlias'); $form->submit($this->request); if ($form->isValid()) { $operation = $form->getData(); $pimFilters = $this->gridFilterAdapter->adapt($this->request); $operation->setFilters($pimFilters); $jobCode = $operation->getBatchJobCode(); $jobInstance = $this->doctrine->getRepository('Akeneo\\Component\\Batch\\Model\\JobInstance')->findOneBy(['code' => $jobCode]); if (null === $jobInstance) { throw new NotFoundResourceException(sprintf('No job found with job code "%s"', $jobCode)); } $operation->finalize(); $rawConfiguration = $operation->getBatchConfig(); $this->simpleJobLauncher->launch($jobInstance, $this->tokenStorage->getToken()->getUser(), $rawConfiguration); } if ($form->isValid()) { $this->request->getSession()->getFlashBag()->add('success', new Message(sprintf('pim_enrich.mass_edit_action.%s.launched_flash', $operationAlias))); $route = $this->getRouteFromMapping($gridName); return new RedirectResponse($this->router->generate($route, ['dataLocale' => $this->getQueryParams()['dataLocale']])); } return $this->templating->renderResponse(sprintf('PimEnrichBundle:MassEditAction:configure/%s.html.twig', $operationAlias), ['form' => $form->createView(), 'operationAlias' => $operationAlias, 'itemsName' => $itemsName, 'productCount' => $productCount, 'queryParams' => $this->getQueryParams()]); }
function it_renders_dashboard_with_statistics(Request $request, DashboardStatisticsProviderInterface $dashboardStatsProvider, EngineInterface $templatingEngine, Response $response) { $dashboardStats = new DashboardStatistics(1245, 5, 6); $dashboardStatsProvider->getStatistics()->willReturn($dashboardStats); $templatingEngine->renderResponse('SyliusAdminBundle:Dashboard:index.html.twig', ['statistics' => $dashboardStats])->willReturn($response); $this->indexAction($request)->shouldReturn($response); }
/** * Edit a job instance * * @param Request $request * @param int $id * * @return \Symfony\Component\HttpFoundation\Response */ public function editAction(Request $request, $id) { try { $jobInstance = $this->getJobInstance($id); } catch (NotFoundHttpException $e) { $this->request->getSession()->getFlashBag()->add('error', new Message($e->getMessage())); return $this->redirectToIndexView(); } $this->eventDispatcher->dispatch(JobProfileEvents::PRE_EDIT, new GenericEvent($jobInstance)); $form = $this->formFactory->create($this->jobInstanceType, $jobInstance); if ($request->isMethod('POST')) { $form->handleRequest($request); if ($form->isValid()) { $this->entityManager->persist($jobInstance); $this->entityManager->flush(); $this->request->getSession()->getFlashBag()->add('success', new Message(sprintf('flash.%s.updated', $this->getJobType()))); return $this->redirectToShowView($jobInstance->getId()); } } $this->eventDispatcher->dispatch(JobProfileEvents::POST_EDIT, new GenericEvent($jobInstance)); if (null === ($template = $jobInstance->getJob()->getEditTemplate())) { $template = sprintf('PimImportExportBundle:%sProfile:edit.html.twig', ucfirst($this->getJobType())); } return $this->templating->renderResponse($template, ['jobInstance' => $jobInstance, 'form' => $form->createView()]); }
/** * @Route("/list/{page}", defaults={"page" = 1},name="ad_list") */ public function listAction($page) { /** @var $adManager \Lsroudi\ClassifiedAdsBundle\Manager\AdManager */ $adManager = $this->container->get('lsroudi_classified_ads.ad.manager'); /** @var $dispatcher \Symfony\Component\EventDispatcher\EventDispatcherInterface */ $dispatcher = $this->container->get('event_dispatcher'); $qb = $adManager->findAds(); /* customize query with event pattern */ $request = $this->container->get('request'); $queryevent = new FilterQueryForAdEvent($request); $dispatcher->dispatch(LsroudiClassifiedAdsEvents::AD_LIST_INIT, $queryevent); if (null != $queryevent->getQuery()) { $qb = $queryevent->getQuery(); } $adapter = new DoctrineORMAdapter($qb); $pagerfanta = new Pagerfanta($adapter); try { $entities = $pagerfanta->setMaxPerPage(5)->setCurrentPage($page)->getCurrentPageResults(); } catch (\Pagerfanta\Exception\NotValidCurrentPageException $e) { throw new \Exception("Page not found."); } $event = new FilterListAdResponseEvent($entities, $pagerfanta); $dispatcher->dispatch(LsroudiClassifiedAdsEvents::AD_LIST_GENERATED, $event); if (null != ($response = $event->getResponse())) { return $response; } return $this->templating->renderResponse('LsroudiClassifiedAdsBundle:Ad:list.html.twig', array('entities' => $entities, 'pager' => $pagerfanta)); }
/** * @param Request $request * * @return Response */ public function loginAction(Request $request) { $lastError = $this->authenticationUtils->getLastAuthenticationError(); $lastUsername = $this->authenticationUtils->getLastUsername(); $template = $request->attributes->get('_sylius[template]', 'SyliusUiBundle:Security:login.html.twig', true); $formType = $request->attributes->get('_sylius[form]', 'sylius_security_login', true); $form = $this->formFactory->createNamed('', $formType); return $this->templatingEngine->renderResponse($template, ['form' => $form->createView(), 'last_username' => $lastUsername, 'last_error' => $lastError]); }
/** * @param Request $request * * @return Response */ public function loginAction(Request $request) { $lastError = $this->authenticationUtils->getLastAuthenticationError(); $lastUsername = $this->authenticationUtils->getLastUsername(); $options = $request->attributes->get('_sylius'); $template = isset($options['template']) ? $options['template'] : 'SyliusUiBundle:Security:login.html.twig'; $formType = isset($options['form']) ? $options['form'] : SecurityLoginType::class; $form = $this->formFactory->createNamed('', $formType); return $this->templatingEngine->renderResponse($template, ['form' => $form->createView(), 'last_username' => $lastUsername, 'last_error' => $lastError]); }
/** * @param \Symfony\Bundle\FrameworkBundle\Templating\EngineInterface $templating * @param \Symfony\Component\Security\Http\Authentication\AuthenticationUtils $authenticationUtils * @param \Symfony\Component\HttpFoundation\Response $response */ function it_render_login_template_in_login_action($templating, $authenticationUtils, $response) { $error = new \Exception('message'); $authenticationUtils->getLastAuthenticationError()->willReturn($error); $authenticationUtils->getLastUsername()->willReturn('user'); $templating->renderResponse('FSiAdminSecurityBundle:Security:login.html.twig', array('error' => $error, 'last_username' => 'user'))->willReturn($response); $this->loginAction()->shouldReturn($response); }