Esempio n. 1
0
 protected function assertRegisterMailSend($user)
 {
     $this->assertEquals(1, OptinTestHelper::getMailsCount($this->mailsFromFileTransportDirectory));
     $mailsContent = OptinTestHelper::getFileMailsContent($this->mailsFromFileTransportDirectory);
     $actualMailContent = $mailsContent[0];
     $actualOptinCode = OptinTestHelper::getOptinCodeFromMailContent($actualMailContent);
     $optinService = new \Cms\Service\Optin('Optin');
     $optin = $optinService->getDao()->getByCode($actualOptinCode);
     $this->assertEquals($actualOptinCode, $optin->getCode());
     $this->assertEquals(\Orm\Entity\Optin::MODE_REGISTER, $optin->getMode());
     $this->assertEquals($optin->getUser()->getId(), $user->getId());
     $this->assertRegisterMailSendSuccessfully($optin, $optin->getUser(), $actualMailContent);
 }
Esempio n. 2
0
 /**
  * @test
  * @group integration
  */
 public function test_registerShouldSendOptinMailFromOwnerAdress()
 {
     // ARRANGE
     $expectedOwner = ConfigHelper::setOwner();
     $expectedFromUser = array('email' => $expectedOwner['email'], 'name' => $expectedOwner['firstname'] . ' ' . $expectedOwner['lastname']);
     $userId = 'USER-reg00gc0-b7a3-4599-b396-94c8bb6c10d9-USER';
     // ACT
     $this->dispatchWithParams('user/register', array('ids' => array($userId)));
     // ASSERT
     $this->getValidatedSuccessResponse();
     $this->assertEquals(1, OptinTestHelper::getMailsCount($this->mailsFromFileTransportDirectory));
     $mailsContent = OptinTestHelper::getFileMailsContent($this->mailsFromFileTransportDirectory);
     $actualMailContent = $mailsContent[0];
     $actualOptinCode = OptinTestHelper::getOptinCodeFromMailContent($actualMailContent);
     $optinService = new \Cms\Service\Optin('Optin');
     $optin = $optinService->getDao()->getByCode($actualOptinCode);
     $this->assertRegisterMailSendSuccessfully($optin, $optin->getUser(), $expectedFromUser, $actualMailContent);
 }
Esempio n. 3
0
 /**
  * @test
  * @group integration
  */
 public function editUserShouldNotDeleteAssociatedOptinAsExpectedWhenPasswordIsNotSet()
 {
     $userId = 'USER-de67e2cf-1175-45e9-bcbd-a25cee8a74e0-USER';
     $optinService = new \Cms\Service\Optin('Optin');
     $registerOptinPre = $optinService->getDao()->getByUserId($userId);
     $this->assertInstanceOf('\\Orm\\Entity\\OptIn', $registerOptinPre);
     $this->assertEquals(\Orm\Entity\OptIn::MODE_REGISTER, $registerOptinPre->getMode());
     $lastname = 'edit_user_optin_lastname_0_edit';
     $firstname = 'edit_user_optin_firstname_0_edit';
     $gender = 'm';
     $superuser = '******';
     $email = '*****@*****.**';
     $requestEndpoint = '/user/edit/params/{"id":"%s","email":"%s","lastname":"%s",' . '"firstname":"%s","gender":"%s","superuser":"******"}';
     $createRequest = sprintf($requestEndpoint, $userId, $email, $lastname, $firstname, $gender, $superuser);
     $this->dispatch($createRequest);
     $response = new Response($this->getResponseBody());
     $this->assertTrue($response->getSuccess());
     $registerOptinPost = $optinService->getDao()->getByUserId($userId);
     $this->assertInstanceOf('\\Orm\\Entity\\OptIn', $registerOptinPost);
     $this->assertEquals(\Orm\Entity\OptIn::MODE_REGISTER, $registerOptinPost->getMode());
     $this->assertEquals($registerOptinPre, $registerOptinPost);
 }