本文整理汇总了PHP中AccountTestHelper类的典型用法代码示例。如果您正苦于以下问题:PHP AccountTestHelper类的具体用法?PHP AccountTestHelper怎么用?PHP AccountTestHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccountTestHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
}
示例2: testRequiredAttributesAreMissingFromLayout
public function testRequiredAttributesAreMissingFromLayout()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$account = AccountTestHelper::createAccountByNameForOwner('aTestAccount', $super);
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/create');
$this->assertNotContains('There are required fields missing from the following layout', $content);
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
$this->assertNotContains('There are required fields missing from the following layout', $content);
$this->setGetArray(array('id' => $account->id));
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/edit');
$this->assertNotContains('There are required fields missing from the following layout', $content);
//Now create an attribute that is required.
$this->createTextCustomFieldByModule('AccountsModule', 'text');
$content = $this->runControllerWithExitExceptionAndGetContent('accounts/default/create');
$this->assertContains('There are required fields missing from the following layout', $content);
$content = $this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
$this->assertNotContains('There are required fields missing from the following layout', $content);
$this->setGetArray(array('id' => $account->id));
$content = $this->runControllerWithExitExceptionAndGetContent('accounts/default/edit');
$this->assertContains('There are required fields missing from the following layout', $content);
//Remove the new field.
$modelAttributesAdapterClassName = TextAttributeForm::getModelAttributeAdapterNameForSavingAttributeFormData();
$adapter = new $modelAttributesAdapterClassName(new Account());
$adapter->removeAttributeMetadata('text');
RequiredAttributesValidViewUtil::resolveToRemoveAttributeAsMissingRequiredAttribute('Account', 'text');
$account = new Account();
$this->assertFalse($account->isAttribute('text'));
unset($account);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:29,代码来源:RequiredAttributesViewValidityWalkthroughTest.php
示例3: testProperlyDeletingActivityItems
public function testProperlyDeletingActivityItems()
{
Yii::app()->user->userModel = User::getByUsername('super');
$count = ZurmoRedBean::getRow('select count(*) count from activity_item');
$this->assertEquals(0, $count['count']);
$account = AccountTestHelper::createAccountByNameForOwner('anAccount', Yii::app()->user->userModel);
$deleted = $account->delete();
$this->assertTrue($deleted);
$count = ZurmoRedBean::getRow('select count(*) count from activity_item');
$this->assertEquals(0, $count['count']);
$account2 = AccountTestHelper::createAccountByNameForOwner('anAccount2', Yii::app()->user->userModel);
$opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('anOpp', Yii::app()->user->userModel);
$task = TaskTestHelper::createTaskWithOwnerAndRelatedAccount('aTask', Yii::app()->user->userModel, $account2);
$task->activityItems->add($opportunity);
$this->assertTrue($task->save());
$taskId = $task->id;
$task->forget();
RedBeansCache::forgetAll();
$count = ZurmoRedBean::getRow('select count(*) count from activity_item');
$this->assertEquals(2, $count['count']);
$deleted = $account2->delete();
$this->assertTrue($deleted);
$account2->forget();
$count = ZurmoRedBean::getRow('select count(*) count from activity_item');
$this->assertEquals(1, $count['count']);
RedBeansCache::forgetAll();
//Make sure things render ok even with the account deleted.
$content = ActivitiesUtil::renderSummaryContent(Task::getById($taskId), 'someUrl', LatestActivitiesConfigurationForm::OWNED_BY_FILTER_ALL, 'HomeModule');
}
示例4: 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
示例5: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
Yii::app()->user->userModel = User::getByUsername('nobody');
self::$account = AccountTestHelper::createAccountByNameForOwner('superAccount', Yii::app()->user->userModel);
self::$contact = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', Yii::app()->user->userModel, self::$account);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:7,代码来源:AccountContactAffiliationsRegularUserWalkthroughTest.php
示例6: testUnlinkContactForAccount
public function testUnlinkContactForAccount()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$simpleUser = User::getByUsername('simpleUser');
Yii::app()->user->userModel = $simpleUser;
$simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
$simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
$simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
$simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
$this->assertTrue($simpleUser->save());
$account = AccountTestHelper::createAccountByNameForOwner('simpleUserAccount', $simpleUser);
$contact = ContactTestHelper::createContactWithAccountByNameForOwner('simpleUserContact', $simpleUser, $account);
$accounts = Account::getAll();
$this->assertEquals(1, count($accounts));
$contacts = Contact::getAll();
$this->assertEquals(1, count($contacts));
$superAccountId = self::getModelIdByModelNameAndName('Account', 'simpleUserAccount');
$this->setGetArray(array('id' => $superAccountId));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
$contactId = self::getModelIdByModelNameAndName('Contact', 'simpleUserContact simpleUserContactson');
//unlinking the contact
$this->setGetArray(array('id' => $contactId, 'relationModelClassName' => 'Account', 'relationModelId' => $superAccountId, 'relationModelRelationName' => 'contacts'));
$content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/unlink', true);
$accounts = Account::getAll();
$this->assertEquals(1, count($accounts));
$contacts = Contact::getAll();
$contactId = $contacts[0]->id;
$contacts[0]->forget();
$contact = Contact::getById($contactId);
$this->assertTrue($contact->account->id < 0);
}
示例7: testRegularUserAllControllerActionsNoElevation
public function testRegularUserAllControllerActionsNoElevation()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$superAccount = AccountTestHelper::createAccountByNameForOwner('accountOwnedBySuper', $super);
//Create address array for the account owned by super user.
$address = array('street1' => '123 Knob Street', 'street2' => 'Apartment 4b', 'city' => 'Chicago', 'state' => 'Illinois', 'postalCode' => '60606', 'country' => 'USA');
//Assign Address to the user account.
AddressGeoCodeTestHelper::updateTestAccountsWithBillingAddress($superAccount->id, $address, $super);
//Fetch Latitute and Longitude values for address and save in Address.
AddressMappingUtil::updateChangedAddresses();
$accounts = Account::getByName('accountOwnedBySuper');
$this->assertEquals(1, count($accounts));
$this->assertEquals(round('42.11529', 4), round($accounts[0]->billingAddress->latitude, 4));
$this->assertEquals(round('-87.976399', 4), round($accounts[0]->billingAddress->longitude, 4));
$this->assertEquals(0, $accounts[0]->billingAddress->invalid);
$addressString = $accounts[0]->billingAddress->makeAddress();
$this->setGetArray(array('addressString' => $addressString, 'latitude' => $accounts[0]->billingAddress->latitude, 'longitude' => $accounts[0]->billingAddress->longitude));
Yii::app()->user->userModel = User::getByUsername('nobody');
//Now test account details portlet controller actions
$this->setGetArray(array('id' => $superAccount->id));
$this->resetPostArray();
$this->runControllerShouldResultInAccessFailureAndGetContent('accounts/default/details');
//The map should always be available. Not controlled by rights.
$this->setGetArray(array('addressString' => 'anAddress String', 'latitude' => '45.00', 'longitude' => '45.00'));
$content = $this->runControllerWithNoExceptionsAndGetContent('maps/default/mapAndPoint');
$this->assertNotContains('Access Failure', $content);
}
示例8: 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.
AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount3', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount4', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount5', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount6', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount7', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount8', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount9', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount10', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount11', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount12', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount13', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount14', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount15', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount16', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount17', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount18', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount19', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount20', $super);
//Setup default dashboard.
Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
}
示例9: 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.
$account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account);
OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp2', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp3', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp4', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp5', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp6', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp7', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp8', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp9', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp10', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp11', $super, $account);
OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp12', $super, $account);
//Setup default dashboard.
Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
}
示例10: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $super;
AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:TaskStatusDropDownRedBeanModelAttributeValueToExportValueAdapterTest.php
示例11: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
$headquarters = AccountTestHelper::createAccountByNameForOwner('Headquarters', $super);
$division1 = AccountTestHelper::createAccountByNameForOwner('Division1', $super);
$division2 = AccountTestHelper::createAccountByNameForOwner('Division2', $super);
$ceo = ContactTestHelper::createContactWithAccountByNameForOwner('ceo', $super, $headquarters);
$div1President = ContactTestHelper::createContactWithAccountByNameForOwner('div1 President', $super, $division1);
$div2President = ContactTestHelper::createContactWithAccountByNameForOwner('div2 President', $super, $division2);
$opportunity = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('big opp', $super, $headquarters);
$opportunityDiv1 = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('div1 small opp', $super, $division1);
$opportunityDiv2 = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('div2 small opp', $super, $division2);
//attach divisions to headquarters
$headquarters->accounts->add($division1);
$headquarters->accounts->add($division2);
assert($headquarters->save());
// Not Coding Standard
//attach opportunities to contacts
$opportunity->contacts->add($ceo);
assert($opportunity->save());
// Not Coding Standard
//Forget models to ensure relations are known on the next retrieval
$headquarters->forget();
$division1->forget();
$division2->forget();
$ceo->forget();
}
示例12: testDownloadDefaultControllerActions
/**
* Walkthrough test for synchronous download
*/
public function testDownloadDefaultControllerActions()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$accounts = array();
for ($i = 0; $i < 2; $i++) {
$accounts[] = AccountTestHelper::createAccountByNameForOwner('superAccount' . $i, $super);
}
// Check if access is denied if user doesn't have access privileges at all to export actions
Yii::app()->user->userModel = User::getByUsername('nobody');
$nobody = $this->logoutCurrentUserLoginNewUserAndGetByUsername('nobody');
// Provide no ids and without selectALl options.
// This should be result with error and redirect to module page.
$this->runControllerShouldResultInAccessFailureAndGetContent('accounts/default/list');
$this->setGetArray(array('Account_page' => '1', 'export' => '', 'ajax' => '', 'selectAll' => '', 'selectedIds' => ''));
$this->runControllerShouldResultInAccessFailureAndGetContent('accounts/default/export');
// Check if user have access to module action, but not to export action
//Now test peon with elevated rights to accounts
$nobody->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
$nobody->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
$nobody->setRight('AccountsModule', AccountsModule::RIGHT_DELETE_ACCOUNTS);
$nobody->setRight('ExportModule', ExportModule::RIGHT_ACCESS_EXPORT);
$this->assertTrue($nobody->save());
// Check if access is denied if user doesn't have access privileges at all to export actions
$nobody = $this->logoutCurrentUserLoginNewUserAndGetByUsername('nobody');
Yii::app()->user->userModel = User::getByUsername('nobody');
// Provide no ids and without selectALl options.
// This should be result with error and redirect to module page.
$this->runControllerWithNoExceptionsAndGetContent('accounts/default/list');
$this->setGetArray(array('Account_page' => '1', 'export' => '', 'ajax' => '', 'selectAll' => '', 'selectedIds' => ''));
$response = $this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/export');
$this->assertTrue(strstr($response, 'accounts/default/index') !== false);
$this->setGetArray(array('AccountsSearchForm' => array('anyMixedAttributesScope' => array(0 => 'All'), 'anyMixedAttributes' => '', 'name' => 'superAccount', 'officePhone' => ''), 'multiselect_AccountsSearchForm_anyMixedAttributesScope' => 'All', 'selectAll' => '1', 'selectedIds' => '', 'Account_page' => '1', 'export' => '', 'ajax' => ''));
$response = $this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/export');
$this->assertTrue(strstr($response, 'accounts/default/index') !== false);
$this->setGetArray(array('AccountsSearchForm' => array('anyMixedAttributesScope' => array(0 => 'All'), 'anyMixedAttributes' => '', 'name' => '', 'officePhone' => ''), 'multiselect_AccountsSearchForm_anyMixedAttributesScope' => 'All', 'selectAll' => '', 'selectedIds' => "{$accounts[0]->id}, {$accounts[1]->id}", 'Account_page' => '1', 'export' => '', 'ajax' => ''));
$response = $this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/export');
$this->assertTrue(strstr($response, 'accounts/default/index') !== false);
$this->assertContains('There is no data to export.', Yii::app()->user->getFlash('notification'));
//give nobody access to read and write
Yii::app()->user->userModel = $super;
foreach ($accounts as $account) {
$account->addPermissions($nobody, Permission::READ_WRITE_CHANGE_PERMISSIONS);
AllPermissionsOptimizationUtil::securableItemGivenPermissionsForUser($account, $nobody);
$this->assertTrue($account->save());
}
//Now the nobody user should be able to access the edit view and still the details view.
Yii::app()->user->userModel = $nobody;
$this->setGetArray(array('AccountsSearchForm' => array('anyMixedAttributesScope' => array(0 => 'All'), 'anyMixedAttributes' => '', 'name' => '', 'officePhone' => ''), 'multiselect_AccountsSearchForm_anyMixedAttributesScope' => 'All', 'selectAll' => '1', 'selectedIds' => '', 'Account_page' => '1', 'export' => '', 'ajax' => ''));
$response = $this->runControllerWithExitExceptionAndGetContent('accounts/default/export');
$this->assertEquals('Testing download.', $response);
$this->setGetArray(array('AccountsSearchForm' => array('anyMixedAttributesScope' => array(0 => 'All'), 'anyMixedAttributes' => '', 'name' => '', 'officePhone' => ''), 'multiselect_AccountsSearchForm_anyMixedAttributesScope' => 'All', 'selectAll' => '', 'selectedIds' => "{$accounts[0]->id}, {$accounts[1]->id}", 'Account_page' => '1', 'export' => '', 'ajax' => ''));
$response = $this->runControllerWithExitExceptionAndGetContent('accounts/default/export');
$this->assertEquals('Testing download.', $response);
// No matches
$this->setGetArray(array('AccountsSearchForm' => array('anyMixedAttributesScope' => array(0 => 'All'), 'anyMixedAttributes' => '', 'name' => 'missingName', 'officePhone' => ''), 'multiselect_AccountsSearchForm_anyMixedAttributesScope' => 'All', 'Account_page' => '1', 'selectAll' => '1', 'selectedIds' => '', 'export' => '', 'ajax' => ''));
$response = $this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/export');
$this->assertTrue(strstr($response, 'accounts/default/index') !== false);
}
示例13: 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.
AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
}
示例14: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$account = AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
MeetingTestHelper::createCategories();
}
示例15: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
TaskTestHelper::createTaskByNameForOwner('My Task', $super);
AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
}