Пример #1
0
 /**
  *  signup index action test
  */
 public function testIndex()
 {
     $mailTransportMock = $this->getMockBuilder('Zend\\Mail\\Transport\\Smtp')->disableOriginalConstructor()->getMock();
     $mailTransportMock->expects($this->once())->method('send')->will($this->returnValue(null));
     $mailMessageMock = $this->getMockBuilder('Zend\\Mail\\Message')->disableOriginalConstructor()->getMock();
     $mailMessageMock->expects($this->once())->method('addTo')->will($this->returnSelf());
     $mailMessageMock->expects($this->once())->method('setSubject')->will($this->returnSelf());
     $mailMessageMock->expects($this->once())->method('setBody')->will($this->returnSelf());
     $this->getApplicationServiceLocator()->setAllowOverride(true);
     $this->getApplicationServiceLocator()->setService('mail.transport', $mailTransportMock);
     $this->getApplicationServiceLocator()->setService('mail.message', $mailMessageMock);
     $form = new SignupForm('create-user', ['serviceLocator' => $this->getApplicationServiceLocator()]);
     $data = ['security' => $form->get('security')->getValue(), 'email' => '*****@*****.**', 'password' => '123456', 'repeat-password' => '123456'];
     $this->dispatch('/user/signup/index', 'POST', $data);
     $this->assertResponseStatusCode(302);
     $this->assertRedirectTo('/');
 }