• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP UserTestHelper类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中UserTestHelper的典型用法代码示例。如果您正苦于以下问题:PHP UserTestHelper类的具体用法?PHP UserTestHelper怎么用?PHP UserTestHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了UserTestHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: 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));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:35,代码来源:MissionTest.php


示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     ContactsModule::loadStartingData();
     SecurityTestHelper::createSuperAdmin();
     $sally = UserTestHelper::createBasicUser('sally');
     $sally->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $sally->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $sally->setRight('MeetingsModule', MeetingsModule::RIGHT_ACCESS_MEETINGS);
     $sally->setRight('OpportunitiesModule', OpportunitiesModule::RIGHT_ACCESS_OPPORTUNITIES);
     $sally->setRight('ReportsTestModule', ReportsTestModule::RIGHT_ACCESS_REPORTS_TESTS);
     if (!$sally->save()) {
         throw new FailedToSaveModelException();
     }
     $sarah = UserTestHelper::createBasicUser('sarah');
     $sarah->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $sarah->setRight('LeadsModule', LeadsModule::RIGHT_ACCESS_LEADS);
     $sarah->setRight('MeetingsModule', MeetingsModule::RIGHT_ACCESS_MEETINGS);
     $sarah->setRight('OpportunitiesModule', OpportunitiesModule::RIGHT_ACCESS_OPPORTUNITIES);
     $sarah->setRight('ReportsTestModule', ReportsTestModule::RIGHT_ACCESS_REPORTS_TESTS);
     if (!$sarah->save()) {
         throw new FailedToSaveModelException();
     }
     $nobody = UserTestHelper::createBasicUser('nobody');
     if (!$nobody->save()) {
         throw new FailedToSaveModelException();
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:28,代码来源:ReportDataProviderTest.php


示例3: testPasswordExpiresPolicyRules

 public function testPasswordExpiresPolicyRules()
 {
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $everyoneGroup->save();
     $user = UserTestHelper::createBasicUser('Bobby');
     $id = $user->id;
     unset($user);
     $user = User::getById($id);
     $adapter = new UserGroupMembershipToViewAdapter($user);
     $viewData = $adapter->getViewData();
     $compareData = array($everyoneGroup->id => array('displayName' => 'Everyone', 'canRemoveFrom' => false));
     $this->assertEquals($compareData, $viewData);
     $a = new Group();
     $a->name = 'AAA';
     $this->assertTrue($a->save());
     $a->users->add($user);
     $this->assertTrue($a->save());
     $user->forget();
     $groupId = $a->id;
     $a->forget();
     unset($a);
     $user = User::getById($id);
     $adapter = new UserGroupMembershipToViewAdapter($user);
     $viewData = $adapter->getViewData();
     $compareData = array($everyoneGroup->id => array('displayName' => 'Everyone', 'canRemoveFrom' => false), $groupId => array('displayName' => 'AAA', 'canRemoveFrom' => true));
     $this->assertEquals($compareData, $viewData);
     $user->forget();
     unset($user);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:29,代码来源:UserGroupMembershipToViewAdapterTest.php


示例4: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = User::getByUsername('super');
     $billy = UserTestHelper::createBasicUser('billy');
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:7,代码来源:MashableUtilTest.php


示例5: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $super = User::getByUsername('super');
     $super->primaryEmail = new Email();
     $super->primaryEmail->emailAddress = '[email protected]';
     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;
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:27,代码来源:WorkflowEmailMessageProcessingHelperTest.php


示例6: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = User::getByUsername('super');
     $bobby = UserTestHelper::createBasicUser('bobby');
     $sarah = UserTestHelper::createBasicUser('sarah');
     self::$superUserId = $super->id;
     self::$bobbyUserId = $bobby->id;
     self::$sarahUserId = $sarah->id;
     $currency = Currency::makeBaseCurrency();
     assert($currency->code == 'USD');
     // Not Coding Standard
     self::$baseCurrencyId = $currency->id;
     $currency = new Currency();
     $currency->code = 'EUR';
     $currency->rateToBase = 2;
     assert($currency->save());
     // Not Coding Standard
     self::$eurCurrencyId = $currency->id;
     $values = array('A1', 'B2', 'C3', 'D4', 'E5', 'F6');
     $fieldData = CustomFieldData::getByName('WorkflowTestDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('A1', 'B2', 'C3', 'D4', 'E5', 'F6');
     $fieldData = CustomFieldData::getByName('WorkflowTestRadioDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('M1', 'M2', 'M3', 'M4', 'M5', 'M6');
     $fieldData = CustomFieldData::getByName('WorkflowTestMultiDropDown');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('M1', 'M2', 'M3', 'M4', 'M5', 'M6');
     $fieldData = CustomFieldData::getByName('WorkflowTestTagCloud');
     $fieldData->serializedData = serialize($values);
     $saved = $fieldData->save();
     assert($saved);
     // Not Coding Standard
     $loaded = ContactsModule::loadStartingData();
     assert($loaded);
     // Not Coding Standard
     $contactStates = ContactState::getByName('New');
     self::$newState = $contactStates[0];
     $contactStates = ContactState::getByName('In progress');
     self::$inProgressState = $contactStates[0];
     self::$groupTest = new Group();
     self::$groupTest->name = 'test';
     $saved = self::$groupTest->save();
     assert($saved);
     // Not Coding Standard
     $group = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $saved = $group->save();
     assert($saved);
     // Not Coding Standard
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:60,代码来源:WorkflowActionAttributeFormResolveValueTest.php


示例7: 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 = '[email protected]';
     $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;
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:28,代码来源:WorkflowEmailMessageRecipientFormTest.php


示例8: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     AllPermissionsOptimizationUtil::rebuild();
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $everyoneGroup->save();
     $super = User::getByUsername('super');
     //Steven have access to missions module
     $steven = UserTestHelper::createBasicUser('steven');
     $steven->setRight('MissionsModule', MissionsModule::RIGHT_ACCESS_MISSIONS);
     $steven->save();
     //Jack dont have acess to missions module
     $jack = UserTestHelper::createBasicUser('jack');
     $mission = new Mission();
     $mission->owner = $super;
     $mission->takenByUser = $steven;
     $mission->description = 'My test description';
     $mission->reward = 'My test reward';
     $mission->status = Mission::STATUS_AVAILABLE;
     $mission->addPermissions($everyoneGroup, Permission::READ_WRITE);
     assert($mission->save());
     // Not Coding Standard
     AllPermissionsOptimizationUtil::securableItemGivenPermissionsForGroup($mission, $everyoneGroup);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:25,代码来源:MissionsUtilTest.php


示例9: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     SecurityTestHelper::createUsers();
     // set up data owned by super
     Yii::app()->user->userModel = User::getByUsername('super');
     $account1 = AccountTestHelper::createAccountByNameForOwner('account1', Yii::app()->user->userModel);
     $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('contact1', Yii::app()->user->userModel, $account1);
     $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('contact2', Yii::app()->user->userModel, $account1);
     $contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('contact3', Yii::app()->user->userModel, $account1);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact1);
     MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList1, $contact2);
     $member1 = MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList1, $contact3);
     static::$superUserMarketingListId = $marketingList1->id;
     static::$superUserMemberId = $member1->id;
     // set up data owned by nobody
     Yii::app()->user->userModel = UserTestHelper::createBasicUser('nobody');
     $account2 = AccountTestHelper::createAccountByNameForOwner('account2', Yii::app()->user->userModel);
     $contact4 = ContactTestHelper::createContactWithAccountByNameForOwner('contact4', Yii::app()->user->userModel, $account2);
     $contact5 = ContactTestHelper::createContactWithAccountByNameForOwner('contact5', Yii::app()->user->userModel, $account2);
     $contact6 = ContactTestHelper::createContactWithAccountByNameForOwner('contact6', Yii::app()->user->userModel, $account2);
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2');
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact4);
     $member2 = MarketingListMemberTestHelper::createMarketingListMember(1, $marketingList2, $contact5);
     MarketingListMemberTestHelper::createMarketingListMember(0, $marketingList2, $contact6);
     static::$regularUserMarketingListId = $marketingList2->id;
     static::$regularUserMemberId = $member2->id;
     ReadPermissionsOptimizationUtil::rebuild();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:31,代码来源:MarketingListDefaultPortletControllerRegularUserWalkthroughTest.php


示例10: testCreateAndGetTaskById

 /**
  * @depends testCreateTaskWithZerosStampAndEditAgain
  */
 public function testCreateAndGetTaskById()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $accounts = Account::getByName('anAccount');
     $user = UserTestHelper::createBasicUser('Billy');
     $dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
     $completedStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 9000);
     $task = new Task();
     $task->name = 'MyTask';
     $task->owner = $user;
     $task->dueDateTime = $dueStamp;
     $task->completedDateTime = $completedStamp;
     $task->description = 'my test description';
     $task->activityItems->add($accounts[0]);
     $this->assertTrue($task->save());
     $id = $task->id;
     unset($task);
     $task = Task::getById($id);
     $this->assertEquals('MyTask', $task->name);
     $this->assertEquals($dueStamp, $task->dueDateTime);
     $this->assertEquals($completedStamp, $task->completedDateTime);
     $this->assertEquals('my test description', $task->description);
     $this->assertEquals($user, $task->owner);
     $this->assertEquals(1, $task->activityItems->count());
     $this->assertEquals($accounts[0], $task->activityItems->offsetGet(0));
     foreach ($task->activityItems as $existingItem) {
         $castedDownModel = $existingItem->castDown(array('Account'));
         //this should not fail
     }
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:33,代码来源:TaskTest.php


示例11: testRebuildDatabaseWithNonSuperAdminUser

 public function testRebuildDatabaseWithNonSuperAdminUser()
 {
     $steven = UserTestHelper::createBasicUser('Steven');
     Yii::app()->user->userModel = $steven;
     $item = NamedSecurableItem::getByName('AccountsModule');
     $this->assertEquals(Permission::NONE, $item->getEffectivePermissions($steven));
     $accounts = Account::getAll();
     $users = User::getAll();
     $this->assertEquals(0, count($accounts));
     $this->assertEquals(2, count($users));
     $adapter = new ModelAttributesAdapter(new Account());
     $adapter->resolveDatabaseSchemaForModel('Account');
     //Confirm the counts of data are still correct
     $accounts = Account::getAll();
     $users = User::getAll();
     $this->assertEquals(0, count($accounts));
     $this->assertEquals(2, count($users));
     //Explicitly deny read, write, and deny
     Yii::app()->user->userModel = User::getByUsername('super');
     $item->addPermissions($steven, Permission::READ_WRITE_DELETE, Permission::DENY);
     $this->assertTrue($item->save());
     //Make sure steven has explicit deny
     $item = NamedSecurableItem::getByName('AccountsModule');
     $this->assertEquals(Permission::NONE, $item->getEffectivePermissions($steven));
     Yii::app()->user->userModel = $steven;
     $adapter = new ModelAttributesAdapter(new Account());
     $adapter->resolveDatabaseSchemaForModel('Account');
     //Confirm the counts of data are still correct
     $accounts = Account::getAll();
     $users = User::getAll();
     $this->assertEquals(0, count($accounts));
     $this->assertEquals(2, count($users));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:33,代码来源:DesignerRedBeanDatabaseBuilderUtilTest.php


示例12: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $billy = UserTestHelper::createBasicUser('billy');
     EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:EmailMessageSendErrorTest.php


示例13: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     $super = SecurityTestHelper::createSuperAdmin();
     Yii::app()->user->userModel = $super;
     $jim = UserTestHelper::createBasicUser('jim');
     $values = array('Test1', 'Test2', 'Test3', 'Sample', 'Demo');
     $customFieldData = CustomFieldData::getByName('ImportTestDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Multi 1', 'Multi 2', 'Multi 3');
     $customFieldData = CustomFieldData::getByName('ImportTestMultiDropDown');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     $values = array('Cloud 1', 'Cloud 2', 'Cloud 3');
     $customFieldData = CustomFieldData::getByName('ImportTestTagCloud');
     $customFieldData->serializedData = serialize($values);
     $saved = $customFieldData->save();
     assert($saved);
     // Not Coding Standard
     //Ensure the external system id column is present.
     $userTableName = User::getTableName();
     ExternalSystemIdUtil::addExternalIdColumnIfMissing($userTableName);
     ExternalSystemIdUtil::updateByModel($super, 'A');
     ExternalSystemIdUtil::updateByModel($jim, 'B');
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem::getTableName());
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem2::getTableName());
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem3::getTableName());
     ExternalSystemIdUtil::addExternalIdColumnIfMissing(ImportModelTestItem4::getTableName());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:34,代码来源:ImportDataAnalyzerTest.php


示例14: testCreateAndGetGamePointById

 public function testCreateAndGetGamePointById()
 {
     $user = UserTestHelper::createBasicUser('Steven');
     $gamePoint = new GamePoint();
     $gamePoint->person = $user;
     $gamePoint->type = 'SomeType';
     $gamePoint->addValue(10);
     $this->assertTrue($gamePoint->save());
     $id = $gamePoint->id;
     unset($gamePoint);
     $gamePoint = GamePoint::getById($id);
     $this->assertEquals('SomeType', $gamePoint->type);
     $this->assertEquals(10, $gamePoint->value);
     $this->assertEquals($user, $gamePoint->person);
     $this->assertEquals(1, $gamePoint->transactions->count());
     $gamePoint->addValue(50, false);
     $this->assertTrue($gamePoint->save());
     GamePointTransaction::addTransactionResolvedForOptimization($gamePoint, 50);
     $this->assertEquals(60, $gamePoint->value);
     $gamePoint::forgetAll();
     $gamePoint = GamePoint::getById($id);
     $this->assertEquals(60, $gamePoint->value);
     $this->assertEquals(2, $gamePoint->transactions->count());
     $this->assertEquals(10, $gamePoint->transactions[0]->value);
     $this->assertEquals(50, $gamePoint->transactions[1]->value);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:GamePointTest.php


示例15: testCreateAddAndSaveAndRemoveByIndexRelatedModels

 public function testCreateAddAndSaveAndRemoveByIndexRelatedModels()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $user = UserTestHelper::createBasicUser('Billy');
     $account = new Account();
     $account->owner = $user;
     $account->name = 'Wibble Corp';
     $this->assertTrue($account->save());
     for ($i = 0; $i < self::CONTACTS; $i++) {
         $contact = ContactTestHelper::createContactByNameForOwner('sampleContact' . $i, Yii::app()->user->userModel);
         $account->contacts->add($contact);
     }
     $this->assertTrue($account->save());
     $contact = $account->contacts[0];
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
     $this->assertTrue($account->save());
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
     $accountId = $account->id;
     unset($account);
     $account = Account::getById($accountId);
     $this->assertEquals('Wibble Corp', $account->name);
     $this->assertEquals(self::CONTACTS, $account->contacts->count());
     $this->assertEquals("{$account->contacts->count()} records.", strval($account->contacts));
     $contact = $account->contacts[0];
     $description = $contact->description;
     $contact->description = "this is a contact";
     $this->assertTrue($account->isModified());
     $this->assertTrue($contact->isModified());
     $this->assertTrue($account->save());
     $this->assertFalse($account->isModified());
     $this->assertFalse($contact->isModified());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:34,代码来源:RedBeanRelatedModelsTest.php


示例16: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $user = UserTestHelper::createBasicUser('steve');
     $user->primaryEmail->emailAddress = '[email protected]';
     $user->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     assert($user->save());
     // Not Coding Standard
     $contact1 = ContactTestHelper::createContactByNameForOwner('peter', $user);
     $contact1->primaryEmail->emailAddress = '[email protected]';
     $contact1->secondaryEmail->emailAddress = '[email protected]';
     assert($contact1->save());
     // Not Coding Standard
     $contactsOrLeads = ContactSearch::getContactsByAnyEmailAddress('[email protected]', null, null);
     $contact2 = ContactTestHelper::createContactByNameForOwner('jim', $user);
     $contact2->primaryEmail->emailAddress = '[email protected]';
     assert($contact2->save());
     // Not Coding Standard
     $nonExistingUserEmail = '[email protected]';
     self::$user = $user;
     self::$contact1 = $contact1;
     self::$contact2 = $contact2;
     self::$nonExistingUserEmail = $nonExistingUserEmail;
     Yii::app()->imap->imapUsername = '[email protected]';
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:26,代码来源:EmailArchivingJobDocumentationTest.php


示例17: testMakeFormFromGroup

 public function testMakeFormFromGroup()
 {
     $user = UserTestHelper::createBasicUser('Billy');
     $billId = $user->id;
     unset($user);
     $user = User::getById($billId);
     $this->assertEquals('billy', $user->username);
     $user = UserTestHelper::createBasicUser('Jimmy');
     $jimId = $user->id;
     unset($user);
     $user = User::getById($jimId);
     $this->assertEquals('jimmy', $user->username);
     $users = User::GetAll();
     $allUsers = array();
     foreach ($users as $user) {
         $allUsers[$user->id] = strval($user);
     }
     $this->assertEquals(3, count($allUsers));
     $a = new Group();
     $a->name = 'JJJ';
     $this->assertTrue($a->save());
     $this->assertEquals(0, $a->users->count());
     $this->assertEquals(0, $a->groups->count());
     $form = GroupUserMembershipFormUtil::makeFormFromGroup($a);
     $this->assertEquals(array(), $form->userMembershipData);
     $this->assertEquals($allUsers, $form->userNonMembershipData);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:27,代码来源:GroupUserMembershipFormUtilTest.php


示例18: testKanbanItemSave

 public function testKanbanItemSave()
 {
     $accounts = Account::getByName('anAccount');
     $user = UserTestHelper::createBasicUser('Billy');
     $task = new Task();
     $task->name = 'MyTask';
     $task->owner = $user;
     $task->requestedByUser = $user;
     $task->description = 'my test description';
     $taskCheckListItem = new TaskCheckListItem();
     $taskCheckListItem->name = 'Test Check List Item';
     $task->checkListItems->add($taskCheckListItem);
     $task->activityItems->add($accounts[0]);
     $task->status = Task::STATUS_IN_PROGRESS;
     $this->assertTrue($task->save());
     $this->assertEquals(1, KanbanItem::getCount());
     $id = $task->id;
     unset($task);
     $task = Task::getById($id);
     //KanbanItem is created after saving Task
     $kanbanItems = KanbanItem::getAll();
     $this->assertCount(1, $kanbanItems);
     $kanbanItem = $kanbanItems[0];
     $this->assertEquals(KanbanItem::TYPE_IN_PROGRESS, $kanbanItem->type);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:25,代码来源:KanbanItemTest.php


示例19: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $nobody = UserTestHelper::createBasicUser('nobody');
     $nobody->setRight('MarketingListsModule', MarketingListsModule::getAccessRight());
     $saved = $nobody->save();
     static::assertTrue($saved);
     Yii::app()->user->userModel = $nobody;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('nobodyAccount', $nobody);
     $marketingList1 = MarketingListTestHelper::createMarketingListByName('MarketingList1', 'MarketingList Description1');
     $marketingList2 = MarketingListTestHelper::createMarketingListByName('MarketingList2', 'MarketingList Description2');
     for ($i = 0; $i < 17; $i++) {
         if ($i % 2) {
             $unsubscribed = 0;
         } else {
             $unsubscribed = 1;
         }
         $contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('nobodyContact1' . $i, $nobody, $account);
         $contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('nobodyContact2' . $i, $nobody, $account);
         MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList1, $contact1);
         MarketingListMemberTestHelper::createMarketingListMember($unsubscribed, $marketingList2, $contact2);
     }
     AllPermissionsOptimizationUtil::rebuild();
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:26,代码来源:MarketingListMemberControllerRegularUserWalkthroughTest.php


示例20: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     UserTestHelper::createBasicUser('normal');
     $emailBox = EmailBoxUtil::getDefaultEmailBoxByUser(User::getByUsername('super'));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:MarketingListPerformanceChartDataProviderTest.php



注:本文中的UserTestHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP UserUtil类代码示例发布时间:2022-05-23
下一篇:
PHP UserStatus类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap