public static function createTestPasswordResetToken() { self::$testData['user'] = UserTest::createTestUser(); self::$testData['token'] = sha1(mt_rand()); self::$testData['requestDate'] = new DateTime(); return new UserPasswordResetToken(self::$testData); }
public static function createTestEmailVerification() { self::$testData['user'] = UserTest::createTestUser(); self::$testData['token'] = sha1(mt_rand()); self::$testData['requestDate'] = new DateTime(); return new UserEmailVerification(self::$testData); }
public static function createTestUserProfile(User $user = null) { self::$testData['user'] = UserTest::createTestUser(); $socialNetworkIdentity = UserSocialNetworkIdentityTest::createTestIdentity(); self::$testData['socialNetworkIdentities'] = new ArrayCollection(array($socialNetworkIdentity)); self::$testData['timeZone'] = TimeZoneTest::createTestTimeZone(); $testData = self::$testData; if (null !== $user) { $testData['user'] = $user; } return new UserProfile($testData); }
public function setUp() { $fc = FrontController::getInstance(); $fc->resetInstance(); $fc->setControllerDirectory(dirname(__FILE__), 'default'); #\Zend_Registry::set('acl', AclTest::createTestAcl()); $user = UserTest::createTestUser(); $userProfile = UserProfileTest::createTestUserProfile(); $user->setProfile($userProfile); $acl = $this->_getCleanMock('Rexmac\\Zyndax\\Acl\\Acl'); $acl->expects($this->once())->method('getUser')->will($this->returnValue($user)); Zend_Registry::set('acl', $acl); }
public function testSendVerificationEmail() { $siteDomain = 'mytestsite.tld'; $siteName = 'MY_TEST_SITE'; $_SERVER['HTTP_HOST'] = $siteDomain; Zend_Registry::set('siteName', $siteName); $recipient = 'root@localhost'; $user = UserTest::createTestUser(); $user->setEmail($recipient); // Real address in case we actually send mail $mock = new MockMailTransport(); UserService::sendVerificationEmail($user, $mock); $subject = '[' . $siteName . '] Email Verification'; $this->assertTrue($mock->called); $this->assertEquals($subject, $mock->subject); $this->assertEquals('noreply@' . $siteDomain, $mock->from); $this->assertContains($recipient, $mock->recipients); $this->assertContains("Thank you for registering with {$siteName}.", $mock->mail->getBodyText()->getRawContent()); $this->assertContains("From: {$siteName} <noreply@{$siteDomain}>", $mock->header); $this->assertContains("Subject: {$subject}", $mock->header); $this->assertContains("To: {$recipient}", $mock->header); }