本文整理汇总了PHP中UserTestHelper::createBasicUserWithEmailAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP UserTestHelper::createBasicUserWithEmailAddress方法的具体用法?PHP UserTestHelper::createBasicUserWithEmailAddress怎么用?PHP UserTestHelper::createBasicUserWithEmailAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserTestHelper
的用法示例。
在下文中一共展示了UserTestHelper::createBasicUserWithEmailAddress方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ContactsModule::loadStartingData();
$bobbyBoss = UserTestHelper::createBasicUserWithEmailAddress('bobbyBoss');
$sarahBoss = UserTestHelper::createBasicUserWithEmailAddress('sarahBoss');
$superBoss = UserTestHelper::createBasicUserWithEmailAddress('superBoss');
$super = User::getByUsername('super');
$super->primaryEmail = new Email();
$super->primaryEmail->emailAddress = 'super@zurmo.com';
$super->manager = $superBoss;
assert($super->save());
// Not Coding Standard
$bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
$bobby->manager = $bobbyBoss;
assert($bobby->save());
// Not Coding Standard
$sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
$sarah->manager = $sarahBoss;
assert($sarah->save());
// Not Coding Standard
self::$superUserId = $super->id;
self::$bobbyUserId = $bobby->id;
self::$sarahUserId = $sarah->id;
self::$superBossUserId = $superBoss->id;
self::$bobbyBossUserId = $bobbyBoss->id;
self::$sarahBossUserId = $sarahBoss->id;
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = User::getByUsername('super');
$super = User::getByUsername('super');
$super->primaryEmail = new Email();
$super->primaryEmail->emailAddress = 'super@zurmo.com';
assert($super->save());
// Not Coding Standard
$bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
$sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
self::$superUserId = $super->id;
self::$bobbyUserId = $bobby->id;
self::$sarahUserId = $sarah->id;
$emailTemplate = new EmailTemplate();
$emailTemplate->modelClassName = 'WorkflowModelTestItem';
$emailTemplate->type = 1;
$emailTemplate->name = 'some template';
$emailTemplate->subject = 'some subject [[LAST^NAME]]';
$emailTemplate->htmlContent = 'html content [[STRING]]';
$emailTemplate->textContent = 'text content [[PHONE]]';
$saved = $emailTemplate->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
self::$emailTemplate = $emailTemplate;
}
示例3: testCreateAndGetMissionById
public function testCreateAndGetMissionById()
{
$super = User::getByUsername('super');
$fileModel = ZurmoTestHelper::createFileModel();
$steven = UserTestHelper::createBasicUserWithEmailAddress('steven');
$steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
$steven->save();
$dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
$mission = new Mission();
$mission->owner = $super;
$mission->takenByUser = $steven;
$mission->dueDateTime = $dueStamp;
$mission->description = 'My test description';
$mission->reward = 'My test reward';
$mission->status = Mission::STATUS_AVAILABLE;
$mission->files->add($fileModel);
$everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
$mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
$this->assertTrue($mission->save());
AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
$id = $mission->id;
$mission->forget();
unset($mission);
$mission = Mission::getById($id);
$this->assertEquals('My test description', $mission->description);
$this->assertEquals('My test reward', $mission->reward);
$this->assertEquals(Mission::STATUS_AVAILABLE, $mission->status);
$this->assertEquals($super, $mission->owner);
$this->assertEquals($steven, $mission->takenByUser);
$this->assertEquals(1, $mission->files->count());
$this->assertEquals($fileModel, $mission->files->offsetGet(0));
$this->assertEquals($dueStamp, $mission->dueDateTime);
$this->assertTrue(MissionsUtil::hasUserReadMissionLatest($mission, $super));
$this->assertFalse(MissionsUtil::hasUserReadMissionLatest($mission, $steven));
}
示例4: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
self::$super = Yii::app()->user->userModel;
self::$steve = UserTestHelper::createBasicUserWithEmailAddress('steve');
self::$sally = UserTestHelper::createBasicUserWithEmailAddress('sally');
self::$katie = UserTestHelper::createBasicUserWithEmailAddress('katie');
}
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
Yii::app()->user->userModel = SecurityTestHelper::createSuperAdmin();
self::$super = Yii::app()->user->userModel;
self::$steve = UserTestHelper::createBasicUserWithEmailAddress('steve');
NotificationTestHelper::setNotificationSettingsForUser(self::$steve, 'NewTaskNotificationRules');
self::$sally = UserTestHelper::createBasicUserWithEmailAddress('sally');
self::$katie = UserTestHelper::createBasicUserWithEmailAddress('katie');
}
示例6: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
//Setup test data owned by the super user.
OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
ContactsModule::loadStartingData();
$jimmy = UserTestHelper::createBasicUserWithEmailAddress('jimmy');
self::$jimmy = $jimmy;
}
示例7: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = User::getByUsername('super');
$super = User::getByUsername('super');
$super->primaryEmail = new Email();
$super->primaryEmail->emailAddress = 'super@zurmo.com';
assert($super->save());
// Not Coding Standard
//Create alpha group
$group = new Group();
$group->name = 'Alpha';
$saved = $group->save();
assert($saved);
// Not Coding Standard
self::$alphaGroup = $group;
//Now set default permissions to owner and users in group Alpha
$form = UserConfigurationFormAdapter::makeFormFromUserConfigurationByUser($super);
$form->defaultPermissionSetting = UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP;
$form->defaultPermissionGroupSetting = $group->id;
UserConfigurationFormAdapter::setConfigurationFromForm($form, $super);
$bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
$sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
self::$superUserId = $super->id;
self::$bobbyUserId = $bobby->id;
self::$sarahUserId = $sarah->id;
$file = ZurmoTestHelper::createFileModel();
$emailTemplate = new EmailTemplate();
$emailTemplate->builtType = EmailTemplate::BUILT_TYPE_PASTED_HTML;
$emailTemplate->modelClassName = 'WorkflowModelTestItem';
$emailTemplate->type = 1;
$emailTemplate->name = 'some template';
$emailTemplate->subject = 'some subject [[LAST^NAME]]';
$emailTemplate->htmlContent = 'html content [[STRING]]';
$emailTemplate->textContent = 'text content [[PHONE]]';
$emailTemplate->files->add($file);
$saved = $emailTemplate->save();
if (!$saved) {
throw new FailedToSaveModelException();
}
self::$emailTemplate = $emailTemplate;
$everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
assert($everyoneGroup->save());
// Not Coding Standard
}
示例8: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = User::getByUsername('super');
$super->primaryEmail = new Email();
$super->primaryEmail->emailAddress = 'super@zurmo.com';
assert($super->save());
// Not Coding Standard
$bobby = UserTestHelper::createBasicUserWithEmailAddress('bobby');
$sarah = UserTestHelper::createBasicUserWithEmailAddress('sarah');
$jimmy = UserTestHelper::createBasicUserWithEmailAddress('jimmy');
$jimmy2 = UserTestHelper::createBasicUserWithEmailAddress('jimmy2');
$jimmy3 = UserTestHelper::createBasicUserWithEmailAddress('jimmy3');
self::$super = $super;
self::$bobby = $bobby;
self::$sarah = $sarah;
self::$jimmy = $jimmy;
self::$jimmy2 = $jimmy2;
self::$jimmy3 = $jimmy3;
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:20,代码来源:DynamicTriggeredModelRelationUserWorkflowEmailMessageRecipientFormTest.php
示例9: testGetCountByModelClassName
public function testGetCountByModelClassName()
{
$super = User::getByUsername('super');
$user = UserTestHelper::createBasicUserWithEmailAddress('newUser');
Yii::app()->user->userModel = $super;
$this->assertEquals(0, LatestActivitiesUtil::getCountByModelClassName('Note', array(), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL));
$this->assertEquals(0, LatestActivitiesUtil::getCountByModelClassName('Note', array(), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER));
$this->assertEquals(0, LatestActivitiesUtil::getCountByModelClassName('Note', array(), $super->id));
$this->assertEquals(0, LatestActivitiesUtil::getCountByModelClassName('Note', array(), $user->id));
NoteTestHelper::createNoteByNameForOwner('test1', $super);
$this->assertEquals(1, LatestActivitiesUtil::getCountByModelClassName('Note', array(), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL));
$this->assertEquals(1, LatestActivitiesUtil::getCountByModelClassName('Note', array(), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER));
$this->assertEquals(1, LatestActivitiesUtil::getCountByModelClassName('Note', array(), $super->id));
$this->assertEquals(0, LatestActivitiesUtil::getCountByModelClassName('Note', array(), $user->id));
NoteTestHelper::createNoteByNameForOwner('test1', $user);
$this->assertEquals(2, LatestActivitiesUtil::getCountByModelClassName('Note', array(), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL));
$this->assertEquals(1, LatestActivitiesUtil::getCountByModelClassName('Note', array(), LatestActivitiesConfigurationForm::OWNED_BY_FILTER_USER));
$this->assertEquals(1, LatestActivitiesUtil::getCountByModelClassName('Note', array(), $user->id));
}
示例10: testAfterSaveForImportModel
public function testAfterSaveForImportModel()
{
$testUser = UserTestHelper::createBasicUserWithEmailAddress('jimmy');
UserConfigurationFormAdapter::setValue($testUser, false, 'turnOffEmailNotifications');
Yii::app()->user->userModel = User::getByUsername('super');
$this->assertCount(0, EmailMessage::getAll());
$task = new Task();
$task->name = 'MyTaskWithoutImport';
$task->owner = $testUser;
$task->requestedByUser = Yii::app()->user->userModel;
$this->assertTrue($task->save());
$this->assertEquals(2, count($task->notificationSubscribers));
$this->assertCount(1, EmailMessage::getAll());
//With import
$task = new Task();
$task->setScenario('importModel');
$task->name = 'MyTaskWithImport';
$task->owner = $testUser;
$task->requestedByUser = Yii::app()->user->userModel;
$this->assertTrue($task->save());
$this->assertEquals(2, count($task->notificationSubscribers));
$this->assertCount(1, EmailMessage::getAll());
}
示例11: testGetUsersByPartialFullName
/**
* test getUsersByPartialFullName
*/
public function testGetUsersByPartialFullName()
{
$user = UserTestHelper::createBasicUserWithEmailAddress("partialhideuser");
$user->hideFromSelecting = true;
$this->assertTrue($user->save());
unset($user);
$users = UserSearch::getUsersByPartialFullName("partial", 1);
$this->assertEquals(0, count($users));
$user = User::getByUsername('partialhideuser');
$user->hideFromSelecting = false;
$this->assertTrue($user->save());
unset($user);
$users = UserSearch::getUsersByPartialFullName("partial", 1);
$this->assertEquals(1, count($users));
}
示例12: testTaskNotifications
public function testTaskNotifications()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$userOwner = UserTestHelper::createBasicUserWithEmailAddress('TaskUserOwner');
$userRequester = UserTestHelper::createBasicUserWithEmailAddress('TaskUserRequester');
Notification::deleteAll();
EmailMessage::deleteAll();
$dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
$completedStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 9000);
$task = new Task();
$task->name = 'Task for Notifications Test';
$task->owner = $userOwner;
$task->requestedByUser = $userRequester;
$task->dueDateTime = $dueStamp;
$task->completedDateTime = $completedStamp;
$task->description = 'my test description';
$task->status = Task::STATUS_NEW;
$this->assertTrue($task->save());
//New task notification owned by other
$notifications = Notification::getAll();
$emailMessages = EmailMessage::getAll();
$this->assertCount(1, $notifications);
$this->assertCount(1, $emailMessages);
$this->assertContains("The task, 'Task for Notifications Test', is now owned by you.", $notifications[0]->notificationMessage->textContent);
$this->assertContains("The task, 'Task for Notifications Test', is now owned by you.", $emailMessages[0]->content->textContent);
//Deliver task notification
$task->status = TASK::STATUS_AWAITING_ACCEPTANCE;
$task->save();
$notifications = Notification::getAll();
$emailMessages = EmailMessage::getAll();
$this->assertCount(2, $notifications);
$this->assertCount(2, $emailMessages);
$this->assertContains("The task you requested, 'Task for Notifications Test', has been finished. You can now choose to accept or reject the task.", $notifications[1]->notificationMessage->textContent);
$this->assertContains("The task you requested, 'Task for Notifications Test', has been finished. You can now choose to accept or reject the task.", $emailMessages[1]->content->textContent);
//Reject task notification
$task->status = TASK::STATUS_REJECTED;
$task->save();
$notifications = Notification::getAll();
$emailMessages = EmailMessage::getAll();
$this->assertCount(3, $notifications);
$this->assertCount(3, $emailMessages);
$this->assertContains("The task, 'Task for Notifications Test', has been rejected by Clark Kent.", $notifications[2]->notificationMessage->textContent);
$this->assertContains("The task, 'Task for Notifications Test', has been rejected by Clark Kent.", $emailMessages[2]->content->textContent);
//Accept task notification
$task->status = TASK::STATUS_COMPLETED;
$task->save();
$notifications = Notification::getAll();
$emailMessages = EmailMessage::getAll();
$this->assertCount(4, $notifications);
$this->assertCount(4, $emailMessages);
$this->assertContains("The task, 'Task for Notifications Test', was accepted by Clark Kent.", $notifications[3]->notificationMessage->textContent);
$this->assertContains("The task, 'Task for Notifications Test', was accepted by Clark Kent.", $emailMessages[3]->content->textContent);
}