本文整理汇总了PHP中AccountTestHelper类的典型用法代码示例。如果您正苦于以下问题:PHP AccountTestHelper类的具体用法?PHP AccountTestHelper怎么用?PHP AccountTestHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了AccountTestHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
AccountTestHelper::createAccountByNameForOwner('anAccount', $super);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:7,代码来源:KanbanItemTest.php
示例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');
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:29,代码来源:ActivitiesObserverTest.php
示例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);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:32,代码来源:AccountsRegularUserUnlinkWalkthroughTest.php
示例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);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:27,代码来源:MapsRegularUserWalkthroughTest.php
示例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);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:30,代码来源:AccountsSuperUserWalkthroughTest.php
示例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);
}
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:27,代码来源:OpportunitiesSuperUserWalkthroughTest.php
示例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();
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:30,代码来源:ModelsRollUpTest.php
示例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);
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:61,代码来源:AccountsRegularUserExportWalkthroughTest.php
示例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);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:9,代码来源:AccountsRelatedListPortletTest.php
示例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();
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:9,代码来源:MeetingTest.php
示例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);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:9,代码来源:TasksUtilTest.php
示例16: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
Currency::makeBaseCurrency();
//Create a account for testing
$account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:10,代码来源:AccountsSuperUserCustomDateNullValueBugWalkthroughTest.php
示例17: testMakeStringForMultipleLinks
public function testMakeStringForMultipleLinks()
{
$account1 = AccountTestHelper::createAccountByNameForOwner('account1', $this->user);
$result = ReportResultsGridUtil::makeStringForMultipleLinks('account1', 'Account', 'AccountsModule');
$this->assertContains('a target="new"', $result);
$this->assertNotContains('tooltip', $result);
$account2 = AccountTestHelper::createAccountByNameForOwner('account1', $this->user);
$result = ReportResultsGridUtil::makeStringForMultipleLinks('account1', 'Account', 'AccountsModule');
$this->assertContains('<span class="tooltip">2</span>', $result);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:ReportResultsGridUtilTest.php
示例18: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
$super = SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = $super;
ReadPermissionsOptimizationUtil::rebuild();
ContactsModule::loadStartingData();
//Setup test data owned by the super user.
AccountTestHelper::createAccountByNameForOwner('Dinamite', $super);
AccountTestHelper::createAccountByNameForOwner('dino', $super);
}
开发者ID:youprofit,项目名称:Zurmo,代码行数:11,代码来源:ZurmoMixedModelsSearchSuperUserWalkthroughTest.php
示例19: testDownCasts
public function testDownCasts()
{
$possibleDerivationPaths = array(array('SecurableItem', 'OwnedSecurableItem', 'Account'), array('SecurableItem', 'OwnedSecurableItem', 'Person', 'Contact'), array('SecurableItem', 'OwnedSecurableItem', 'Opportunity'));
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$account = AccountTestHelper::createAccountByNameForOwner('Waggle', $super);
$contact = ContactTestHelper::createContactByNameForOwner('Noddy', $super);
$opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('Noddy', $super);
$accountItem = Item::getById($account->getClassId('Item'));
$contactItem = Item::getById($contact->getClassId('Item'));
$opportunityItem = Item::getById($opportunity->getClassId('Item'));
$this->assertTrue($accountItem->isSame($account));
$this->assertTrue($contactItem->isSame($contact));
$this->assertTrue($opportunityItem->isSame($opportunity));
$this->assertFalse($accountItem instanceof Account);
$this->assertFalse($contactItem instanceof Contact);
$this->assertFalse($opportunityItem instanceof Opportunity);
$account2 = $accountItem->castDown($possibleDerivationPaths);
$this->assertEquals('Account', get_class($account2));
//Demonstrate a single array, making sure it casts down properly.
$accountItem2 = Item::getById($account->getClassId('Item'));
$account3 = $accountItem2->castDown(array(array('SecurableItem', 'OwnedSecurableItem', 'Account')));
$this->assertEquals('Account', get_class($account3));
$contact2 = $contactItem->castDown($possibleDerivationPaths);
$opportunity2 = $opportunityItem->castDown($possibleDerivationPaths);
$this->assertTrue($account2->isSame($account));
$this->assertTrue($contact2->isSame($contact));
$this->assertTrue($opportunity2->isSame($opportunity));
$this->assertTrue($account2 instanceof Account);
$this->assertTrue($contact2 instanceof Contact);
$this->assertTrue($opportunity2 instanceof Opportunity);
$account2 = AccountTestHelper::createAccountByNameForOwner('Waggle2', $super);
//By adding a second contact with a relation to the account2, we can demonstrate a bug with how castDown works.
//Since contacts can in fact be attached to accounts via account_id, if a contact exists connected to the account
//we are trying to cast down, then this will cast down even though it shouldn't.
$contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('MrWaggle2', $super, $account2);
try {
$account2CastedDown = $account2->castDown(array(array('SecurableItem', 'OwnedSecurableItem', 'Person', 'Contact')));
$this->fail();
} catch (NotFoundException $e) {
//success
}
//Now try to forget the account and retrieve it.
$account2Id = $account2->id;
$account2->forget();
unset($account2);
$account2 = Account::getById($account2Id);
try {
$account2CastedDown = $account2->castDown(array(array('SecurableItem', 'OwnedSecurableItem', 'Person', 'Contact')));
$this->fail();
} catch (NotFoundException $e) {
//success
}
}
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:54,代码来源:ActivityTest.php
示例20: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
self::$super = User::getByUsername('super');
self::$myUser = UserTestHelper::createBasicUser('myuser');
self::$sally = UserTestHelper::createBasicUser('sally');
Yii::app()->user->userModel = self::$super;
//Setup test data owned by the super user.
$account = AccountTestHelper::createAccountByNameForOwner('superAccount', self::$super);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:11,代码来源:TaskAjaxSuperUserWalkthroughTest.php
注:本文中的AccountTestHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论