コード例 #1
0
ファイル: CreateTest.php プロジェクト: rukzuk/rukzuk
 /**
  * @test
  * @group library
  */
 public function businessShouldCreateUserAsExpected()
 {
     $createValues = array('email' => '*****@*****.**', 'lastname' => 'business_create_test_lastname', 'firstname' => 'business_create_test_firstname', 'gender' => 'm', 'isSuperuser' => false, 'isDeletable' => true);
     $testUser = $this->business->create($createValues);
     $this->assertInstanceOf('\\Cms\\Data\\User', $testUser);
     foreach ($createValues as $field => $value) {
         if ($field !== 'isSuperuser' && $field !== 'isDeletable') {
             $getter = 'get' . $field;
         } else {
             $getter = $field;
         }
         $this->assertSame($createValues[$field], $testUser->{$getter}());
     }
     $this->assertTrue($this->validateUniqueId(new DataUser(), $testUser->getId()));
 }
コード例 #2
0
ファイル: RenewPasswordTest.php プロジェクト: rukzuk/rukzuk
 /**
  * @test
  * @group integration
  */
 public function test_renewPasswordShouldSendRenewMailFromOwnerAdress()
 {
     // ARRANGE
     $expectedOwner = ConfigHelper::setOwner();
     $expectedFromUser = array('email' => $expectedOwner['email'], 'name' => $expectedOwner['firstname'] . ' ' . $expectedOwner['lastname']);
     $userId = 'USER-ren00gc0-b7a3-4599-b396-94c8bb6c10d9-USER';
     $userBusiness = new \Cms\Business\User('User');
     $user = $userBusiness->getById($userId);
     // ACT
     $this->dispatchWithParams('user/renewpassword', array('email' => $user->getEmail()));
     // ASSERT
     $this->getValidatedSuccessResponse();
     $this->assertEquals(1, OptinTestHelper::getMailsCount($this->mailsFromFileTransportDirectory));
     $mailsContent = OptinTestHelper::getFileMailsContent($this->mailsFromFileTransportDirectory);
     $actualMailContent = $mailsContent[0];
     $actualRenewCode = OptinTestHelper::getRenewCodeFromMailContent($actualMailContent);
     $optinService = new \Cms\Service\Optin('Optin');
     $optin = $optinService->getDao()->getByCode($actualRenewCode);
     $this->assertOptinMailSendSuccessfully($optin, $user, $expectedFromUser, $actualMailContent);
 }