本文整理汇总了PHP中Account::getByName方法的典型用法代码示例。如果您正苦于以下问题:PHP Account::getByName方法的具体用法?PHP Account::getByName怎么用?PHP Account::getByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Account
的用法示例。
在下文中一共展示了Account::getByName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
示例2: testCreateAndGetMeetingById
public function testCreateAndGetMeetingById()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$accounts = Account::getByName('anAccount');
$contact1 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $accounts[0]);
$contact2 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $accounts[0]);
$contact3 = ContactTestHelper::createContactWithAccountByNameForOwner('superContact3', $super, $accounts[0]);
$user = UserTestHelper::createBasicUser('Billy');
$startStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
$endStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 11000);
$meeting = new Meeting();
$meeting->name = 'MyMeeting';
$meeting->owner = $user;
$meeting->location = 'my location';
$meeting->category->value = 'Call';
$meeting->startDateTime = $startStamp;
$meeting->endDateTime = $endStamp;
$meeting->description = 'my test description';
$meeting->activityItems->add($accounts[0]);
$meeting->activityItems->add($contact1);
$meeting->activityItems->add($contact2);
$meeting->activityItems->add($contact3);
$this->assertTrue($meeting->save());
$id = $meeting->id;
unset($meeting);
$meeting = Meeting::getById($id);
$this->assertEquals('MyMeeting', $meeting->name);
$this->assertEquals($startStamp, $meeting->startDateTime);
$this->assertEquals($endStamp, $meeting->endDateTime);
$this->assertEquals('my test description', $meeting->description);
$this->assertEquals($user, $meeting->owner);
$this->assertEquals(4, $meeting->activityItems->count());
$this->assertEquals($accounts[0], $meeting->activityItems->offsetGet(0));
}
示例3: testSaveAndRetrievePortlet
public function testSaveAndRetrievePortlet()
{
$user = UserTestHelper::createBasicUser('Steven');
$accounts = Account::getByName('superAccount');
$portlet = new Portlet();
$portlet->column = 2;
$portlet->position = 5;
$portlet->layoutId = 'Test';
$portlet->collapsed = true;
$portlet->viewType = 'AccountsForAccountRelatedList';
$portlet->serializedViewData = serialize(array('title' => 'Testing Title'));
$portlet->user = $user;
$this->assertTrue($portlet->save());
$portlet = Portlet::getById($portlet->id);
$params = array('controllerId' => 'test', 'relationModuleId' => 'test', 'relationModel' => $accounts[0], 'redirectUrl' => 'someRedirect');
$portlet->params = $params;
$unserializedViewData = unserialize($portlet->serializedViewData);
$this->assertEquals(2, $portlet->column);
$this->assertEquals(5, $portlet->position);
$this->assertEquals('Testing Title', $portlet->getTitle());
$this->assertEquals(false, $portlet->isEditable());
$this->assertEquals('Test', $portlet->layoutId);
//$this->assertEquals(true, $portlet->collapsed); //reenable once working
$this->assertEquals('AccountsForAccountRelatedList', $portlet->viewType);
$this->assertEquals($user->id, $portlet->user->id);
$view = $portlet->getView();
}
示例4: 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);
}
示例5: testGetItemIdsByModelAndUser
public function testGetItemIdsByModelAndUser()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$headquarters = Account::getByName('Headquarters');
$headquarters = $headquarters[0];
$division1 = Account::getByName('Division1');
$division1 = $division1[0];
$division2 = Account::getByName('Division2');
$division2 = $division2[0];
$ceo = Contact::getByName('ceo ceoson');
$ceo = $ceo[0];
$div1President = Contact::getByName('div1 President div1 Presidentson');
$div1President = $div1President[0];
$div2President = Contact::getByName('div2 President div2 Presidentson');
$div2President = $div2President[0];
$opportunity = Opportunity::getByName('big opp');
$opportunity = $opportunity[0];
$opportunityDiv1 = Opportunity::getByName('div1 small opp');
$opportunityDiv1 = $opportunityDiv1[0];
$opportunityDiv2 = Opportunity::getByName('div2 small opp');
$opportunityDiv2 = $opportunityDiv2[0];
//Headquarter rollup should include all items created so far.
$this->assertEquals(2, $headquarters->accounts->count());
$itemIds = ModelRollUpUtil::getItemIdsByModelAndUser($headquarters, $super);
$compareItemIds = array();
$this->assertEquals(9, count($itemIds));
$this->assertTrue(in_array($headquarters->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($division1->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($division2->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($ceo->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($div1President->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($div2President->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($opportunity->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($opportunityDiv1->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($opportunityDiv2->getClassId('Item'), $itemIds));
//Ceo rollup would only include the ceo and his opportunity
$itemIds = ModelRollUpUtil::getItemIdsByModelAndUser($ceo, $super);
$compareItemIds = array();
$this->assertEquals(2, count($itemIds));
$this->assertTrue(in_array($ceo->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($opportunity->getClassId('Item'), $itemIds));
//Big Opp rollup will only include big opp and ceo
$itemIds = ModelRollUpUtil::getItemIdsByModelAndUser($opportunity, $super);
$compareItemIds = array();
$this->assertEquals(2, count($itemIds));
$this->assertTrue(in_array($ceo->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($opportunity->getClassId('Item'), $itemIds));
//Division 1 rollup will only include things related to division 1
$itemIds = ModelRollUpUtil::getItemIdsByModelAndUser($division1, $super);
$compareItemIds = array();
$this->assertEquals(3, count($itemIds));
$this->assertTrue(in_array($division1->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($div1President->getClassId('Item'), $itemIds));
$this->assertTrue(in_array($opportunityDiv1->getClassId('Item'), $itemIds));
}
示例6: testMakeStringForLinkOrLinks
/**
* @depends testMakeStringForMultipleLinks
*/
public function testMakeStringForLinkOrLinks()
{
$accounts = Account::getByName('account1');
$account1 = $accounts[0];
$account2 = $accounts[1];
$displayAttribute = new DisplayAttributeForReportForm('AccountsModule', 'Account', Report::TYPE_ROWS_AND_COLUMNS);
$displayAttribute->setModelAliasUsingTableAliasName('abc');
$displayAttribute->attributeIndexOrDerivedType = 'name';
$reportResultsRowData = new ReportResultsRowData(array($displayAttribute), 4);
$reportResultsRowData->addModelAndAlias($account2, 'abc');
$result = ReportResultsGridUtil::makeStringForLinkOrLinks('attribute0', $reportResultsRowData, true, 'account1');
$this->assertContains('<span class="tooltip">2</span>', $result);
$result = ReportResultsGridUtil::makeStringForLinkOrLinks('attribute0', $reportResultsRowData, false, 'account1');
$this->assertContains('a target="new"', $result);
$this->assertContains('id=' . $account2->id, $result);
$this->assertNotContains('tooltip', $result);
}
示例7: testAddingMapPortletToAccountsDetailView
public function testAddingMapPortletToAccountsDetailView()
{
//Lougout previous use and log in as super user
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Retriving the super account id.
$superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
//Create address array for the super account id.
$address = array('street1' => '123 Knob Street', 'street2' => 'Apartment 4b', 'city' => 'Chicago', 'state' => 'Illinois', 'postalCode' => '60606', 'country' => 'USA');
//Assign Address to the super user account.
AddressGeoCodeTestHelper::updateTestAccountsWithBillingAddress($superAccountId, $address, $super);
//Fetch Latitute and Longitude values for address and save in Address.
AddressMappingUtil::updateChangedAddresses();
$accounts = Account::getByName('superAccount');
$this->assertEquals(1, count($accounts));
$this->assertEquals(round('41.8817767', 4), round($accounts[0]->billingAddress->latitude, 4));
$this->assertEquals(round('-87.6371461', 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));
$content = $this->runControllerWithNoExceptionsAndGetContent('maps/default/mapAndPoint');
$this->assertContains('plotMap', $content);
$accounts = Account::getAll();
$this->assertEquals(1, count($accounts));
//Load Model Detail Views
$this->setGetArray(array('id' => $superAccountId, 'lockPortlets' => '0'));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
$portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
$this->assertEquals(3, count($portlets[1]));
$this->assertFalse(array_key_exists(3, $portlets));
$this->assertEquals(4, count($portlets[2]));
foreach ($portlets[2] as $position => $portlet) {
$portlet->delete();
}
$portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
$this->assertFalse(array_key_exists(2, $portlets));
$this->setGetArray(array('modelId' => $superAccountId, 'uniqueLayoutId' => 'AccountDetailsAndRelationsView', 'portletType' => 'MapForAccountAddress', 'redirect' => '0'));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/add', true);
$portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
$this->assertEquals(1, count($portlets[2]));
//Load Model Detail Views
$this->setGetArray(array('id' => $superAccountId, 'lockPortlets' => '0'));
$this->resetPostArray();
$this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
}
示例8: testCopy
public function testCopy()
{
Yii::app()->user->userModel = User::getByUsername('super');
$accounts = Account::getByName('anAccount');
$task = new Task();
$task->name = 'My Task';
$task->owner = Yii::app()->user->userModel;
$task->completedDateTime = '0000-00-00 00:00:00';
$task->activityItems->add($accounts[0]);
$saved = $task->save();
$this->assertTrue($saved);
$taskId = $task->id;
$task->forget();
unset($task);
$task = Task::getById($taskId);
$copyToTask = new Task();
ActivityCopyModelUtil::copy($task, $copyToTask);
$this->assertEquals('My Task', $copyToTask->name);
$this->assertEquals(1, $copyToTask->activityItems->count());
}
示例9: testResolveLinkToModelForCurrentUser
/**
* @depends testCanCurrentUserPerformAction
*/
public function testResolveLinkToModelForCurrentUser()
{
Yii::app()->user->userModel = User::getByUsername('super');
$notSavedAccount = new Account();
$link = ActionSecurityUtil::resolveLinkToModelForCurrentUser('bpoboo', $notSavedAccount, 'AccountsModule', 'accounts/default/details');
$this->assertNull($link);
$accounts = Account::getByName('Supermart');
$betty = User::getByUsername('betty');
$bettyAccount = AccountTestHelper::createAccountByNameForOwner('bopbeebop', $betty);
Yii::app()->user->userModel = $betty;
$link = ActionSecurityUtil::resolveLinkToModelForCurrentUser('bpoboo', $bettyAccount, 'AccountsModule', 'accounts/default/details');
$this->assertEquals('bpoboo', $link);
$betty->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS, Right::ALLOW);
$this->assertTrue($betty->save());
$link = ActionSecurityUtil::resolveLinkToModelForCurrentUser('bpoboo', $bettyAccount, 'AccountsModule', 'accounts/default/details');
$this->assertContains('accounts/default/details', $link);
$this->assertEquals(1, count($accounts));
$link = ActionSecurityUtil::resolveLinkToModelForCurrentUser('bpoboo', $accounts[0], 'AccountsModule', 'accounts/default/details');
$this->assertEquals(null, $link);
}
示例10: testSuperUserAllDefaultControllerActions
public function testSuperUserAllDefaultControllerActions()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Retriving the super account id.
$superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
//Create address array for the super account id.
$address = array('street1' => '123 Knob Street', 'street2' => 'Apartment 4b', 'city' => 'Chicago', 'state' => 'Illinois', 'postalCode' => '60606', 'country' => 'USA');
//Assign Address to the super user account.
AddressGeoCodeTestHelper::updateTestAccountsWithBillingAddress($superAccountId, $address, $super);
//Fetch Latitute and Longitude values for address and save in Address.
AddressMappingUtil::updateChangedAddresses();
$accounts = Account::getByName('superAccount');
$this->assertEquals(1, count($accounts));
$this->assertEquals(round('41.8817767', 4), round($accounts[0]->billingAddress->latitude, 4));
$this->assertEquals(round('-87.6371461', 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));
$content = $this->runControllerWithNoExceptionsAndGetContent('maps/default/mapAndPoint');
$this->assertContains('plotMap', $content);
}
示例11: testSuperUserSavingAccountCreatedBeforeThreeoRequiredCustomAttributesAreCreated
/**
* @see MissingBeanException (Related to why we needed this test in the first place.) Since superAccount
* is created before the attributes, was causing a problem where some parts of the relatedModel beans are not
* present. Catching the MissingBeanException in the RedBeanModel solved this problem.
*/
public function testSuperUserSavingAccountCreatedBeforeThreeoRequiredCustomAttributesAreCreated()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//First create an account before you create multiselect and tagcloud attributes
$account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
$account->forget();
//Test create field list.
$this->resetPostArray();
$this->setGetArray(array('moduleClassName' => 'AccountsModule'));
//Create 2 custom attributes that are required.
$this->createDropDownCustomFieldByModule('AccountsModule', 'dropdown');
$this->createMultiSelectDropDownCustomFieldByModule('AccountsModule', 'multiselect');
$this->createTagCloudCustomFieldByModule('AccountsModule', 'tagcloud');
//Save the account again. Everything is fine.
$account = Account::getByName('superAccount');
$account[0]->save(false);
$account[0]->forget();
//Retrieving the account again at this point should retrieve ok.
$account = Account::getByName('superAccount');
$account[0]->save(false);
$account[0]->forget();
}
示例12: testAddParicipantAndHaveParticipantRemoveSelf
public function testAddParicipantAndHaveParticipantRemoveSelf()
{
return;
//Turn on once issue is fixed with SECURITY_OPTIMIZED and this bug.
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
$fileModel = ZurmoTestHelper::createFileModel();
$accounts = Account::getByName('anAccount');
$steven = UserTestHelper::createBasicUser('steven');
$conversation = new Conversation();
$conversation->owner = $super;
$conversation->subject = 'My test subject';
$conversation->description = 'My test description';
$this->assertTrue($conversation->save());
$sally = UserTestHelper::createBasicUser('sally');
$conversation->addPermissions($sally, Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER);
$conversation->save();
//Log in as sally, and remove her permission
Yii::app()->user->userModel = $sally;
//Breaks because SecurableItem 2 spots using SECURITY_OPTIMIZATION == false, think it is the first spot
//todo: fix.
$conversation->removePermissions(Yii::app()->user->userModel, Permission::READ_WRITE_CHANGE_PERMISSIONS_CHANGE_OWNER, Permission::ALLOW);
}
示例13: testAccountAndContactIndustries
public function testAccountAndContactIndustries()
{
Yii::app()->user->userModel = User::getByUsername('super');
$values = array('Automotive', 'Adult Entertainment', 'Financial Services', 'Mercenaries & Armaments');
$industryFieldData = CustomFieldData::getByName('Industries');
$industryFieldData->defaultValue = $values[0];
$industryFieldData->serializedData = serialize($values);
$this->assertTrue($industryFieldData->save());
unset($industryFieldData);
$user = UserTestHelper::createBasicUser('Billy');
$account = new Account();
$account->name = 'Consoladores-R-Us';
$account->owner = $user;
$data = unserialize($account->industry->data->serializedData);
$this->assertEquals('Automotive', $account->industry->value);
$account->industry->value = $values[1];
$this->assertTrue($account->save());
unset($account);
ContactsModule::loadStartingData();
$states = ContactState::GetAll();
$contact = new Contact();
$contact->firstName = 'John';
$contact->lastName = 'Johnson';
$contact->owner = $user;
$contact->state = $states[0];
$values = unserialize($contact->industry->data->serializedData);
$this->assertEquals(4, count($values));
$contact->industry->value = $values[3];
$this->assertTrue($contact->save());
unset($contact);
$accounts = Account::getByName('Consoladores-R-Us');
$account = $accounts[0];
$this->assertEquals('Adult Entertainment', $account->industry->value);
$contacts = Contact::getAll();
$contact = $contacts[0];
$this->assertEquals('Mercenaries & Armaments', $contact->industry->value);
}
示例14: testGetExportValue
public function testGetExportValue()
{
$data = array();
Yii::app()->user->userModel = User::getByUsername('super');
$accounts = Account::getByName('anAccount');
$user = UserTestHelper::createBasicUser('Billy');
$dueStamp = DateTimeUtil::convertTimestampToDbFormatDateTime(time() + 10000);
$task = new Task();
$task->name = 'MyTask';
$task->owner = $user;
$task->requestedByUser = $user;
$task->dueDateTime = $dueStamp;
$task->status = Task::STATUS_COMPLETED;
$task->description = 'my test description';
$this->assertTrue($task->save());
$adapter = new TaskStatusDropDownRedBeanModelAttributeValueToExportValueAdapter($task, 'status');
$adapter->resolveData($data);
$compareData = array('Completed');
$this->assertEquals($compareData, $data);
$data = array();
$adapter->resolveHeaderData($data);
$compareData = array($task->getAttributeLabel('status'));
$this->assertEquals($compareData, $data);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:24,代码来源:TaskStatusDropDownRedBeanModelAttributeValueToExportValueAdapterTest.php
示例15: testEditOfTheNoteForTheCustomFieldsPlacedForNotesModule
/**
* @depends testEditOfTheNoteForTheTagCloudFieldAfterRemovingAllTagsPlacedForNotesModule
*/
public function testEditOfTheNoteForTheCustomFieldsPlacedForNotesModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Set the date and datetime variable values here.
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormat(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormat(), time());
$datetimeAssert = date('Y-m-d H:i:') . "00";
//Get the super user, account, opportunity and contact id.
$superUserId = $super->id;
$superAccount = Account::getByName('superAccount');
$superContactId = self::getModelIdByModelNameAndName('Contact', 'superContact2 superContact2son');
$superOpportunityId = self::getModelIdByModelNameAndName('Opportunity', 'superOpp');
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
$explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
//Retrieve the note Id based on the created note.
$note = Note::getByName('Note Edit Description');
//Edit a note based on the custom fields.
$this->setGetArray(array('id' => $note[0]->id));
$this->setPostArray(array('Note' => array('occurredOnDateTime' => $datetime, 'description' => 'Note Edit Description', 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'owner' => array('id' => $superUserId), 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'dateCstm' => $date, 'datetimeCstm' => $datetime, 'decimalCstm' => '12', 'picklistCstm' => array('value' => 'b'), 'multiselectCstm' => array('values' => array('gg', 'hh')), 'tagcloudCstm' => array('values' => array('reading', 'surfing')), 'countrylistCstm' => array('value' => 'aaaa'), 'statelistCstm' => array('value' => 'aaa1'), 'citylistCstm' => array('value' => 'ab1'), 'integerCstm' => '11', 'phoneCstm' => '259-784-2069', 'radioCstm' => array('value' => 'e'), 'textCstm' => 'This is a test Edit Text', 'textareaCstm' => 'This is a test Edit TextArea', 'urlCstm' => 'http://wwww.abc-edit.com'), 'ActivityItemForm' => array('Account' => array('id' => $superAccount[0]->id), 'Contact' => array('id' => $superContactId), 'Opportunity' => array('id' => $superOpportunityId))));
$this->runControllerWithRedirectExceptionAndGetUrl('notes/default/edit');
//Check the details if they are saved properly for the custom fields.
$note = Note::getByName('Note Edit Description');
//Retrieve the permission of the note.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Note::getById($note[0]->id));
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals($note[0]->description, 'Note Edit Description');
$this->assertEquals($note[0]->occurredOnDateTime, $datetimeAssert);
$this->assertEquals($note[0]->owner->id, $superUserId);
$this->assertEquals($note[0]->activityItems->count(), 3);
$this->assertEquals(1, count($readWritePermitables));
$this->assertEquals(0, count($readOnlyPermitables));
$this->assertEquals($note[0]->checkboxCstm, '0');
$this->assertEquals($note[0]->currencyCstm->value, 40);
$this->assertEquals($note[0]->currencyCstm->currency->id, $baseCurrency->id);
$this->assertEquals($note[0]->dateCstm, $dateAssert);
$this->assertEquals($note[0]->datetimeCstm, $datetimeAssert);
$this->assertEquals($note[0]->decimalCstm, '12');
$this->assertEquals($note[0]->picklistCstm->value, 'b');
$this->assertEquals($note[0]->integerCstm, 11);
$this->assertEquals($note[0]->phoneCstm, '259-784-2069');
$this->assertEquals($note[0]->radioCstm->value, 'e');
$this->assertEquals($note[0]->textCstm, 'This is a test Edit Text');
$this->assertEquals($note[0]->textareaCstm, 'This is a test Edit TextArea');
$this->assertEquals($note[0]->urlCstm, 'http://wwww.abc-edit.com');
$this->assertEquals($note[0]->countrylistCstm->value, 'aaaa');
$this->assertEquals($note[0]->statelistCstm->value, 'aaa1');
$this->assertEquals($note[0]->citylistCstm->value, 'ab1');
$this->assertContains('gg', $note[0]->multiselectCstm->values);
$this->assertContains('hh', $note[0]->multiselectCstm->values);
$this->assertContains('reading', $note[0]->tagcloudCstm->values);
$this->assertContains('surfing', $note[0]->tagcloudCstm->values);
$metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Note');
$testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $note[0]);
$this->assertEquals(23, $testCalculatedValue);
}