public function testRegisterAction() { $controller = new RegistrationController(); $controller->setContainer($this->container); $this->container->expects($this->exactly(4))->method('get')->with($this->logicalOr('nmn_user_discriminator', 'fos_user.registration.form', 'fos_user.registration.form.handler', 'templating'))->will($this->onConsecutiveCalls($this->userDiscriminator, $this->form, $this->formHandler, $this->templating)); $this->userDiscriminator->expects($this->exactly(1))->method('getRegistrationForm')->will($this->onConsecutiveCalls('form')); $this->container->expects($this->exactly(1))->method('set')->with('fos_user.registration.form', 'form')->will($this->onConsecutiveCalls(null)); $this->container->expects($this->exactly(2))->method('getParameter')->with($this->logicalOr('fos_user.registration.confirmation.enabled', 'fos_user.template.engine'))->will($this->onConsecutiveCalls(false, 'engine')); $this->formHandler->expects($this->exactly(1))->method('process')->will($this->onConsecutiveCalls(false)); $this->templating->expects($this->exactly(1))->method('renderResponse')->will($this->onConsecutiveCalls($this->responseExpected)); $this->form->expects($this->exactly(1))->method('createView')->will($this->onConsecutiveCalls(null)); $response = $controller->registerAction(); $this->assertSame($this->responseExpected, $response); }
public function registerAction() { $discriminator = $this->container->get('nmn_user_discriminator'); $discriminator->setClass('Acme\\UserBundle\\Entity\\UserTwo'); $form = $discriminator->getRegistrationForm(); $return = parent::registerAction(); if ($return instanceof RedirectResponse) { return $return; } return $this->container->get('templating')->renderResponse('AcmeUserBundle:Registration:user_two.form.html.' . $this->getEngine(), array('form' => $form->createView(), 'theme' => $this->container->getParameter('fos_user.template.theme'))); }