本文整理汇总了PHP中DateTimeUtil::getLocaleDateFormatForInput方法的典型用法代码示例。如果您正苦于以下问题:PHP DateTimeUtil::getLocaleDateFormatForInput方法的具体用法?PHP DateTimeUtil::getLocaleDateFormatForInput怎么用?PHP DateTimeUtil::getLocaleDateFormatForInput使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateTimeUtil
的用法示例。
在下文中一共展示了DateTimeUtil::getLocaleDateFormatForInput方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveDefaultOptions
protected function resolveDefaultOptions()
{
$this->options['showOn'] = 'both';
$this->options['buttonText'] = ZurmoHtml::tag('span', array(), '<!--Date-->');
$this->options['showButtonPanel'] = true;
$this->options['buttonImageOnly'] = false;
$this->options['dateFormat'] = YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormatForInput());
}
示例2: resolveDefaultOptions
protected function resolveDefaultOptions()
{
$this->options['stepMinute'] = 5;
$this->options['timeText'] = Zurmo::t('Core', 'Time');
$this->options['hourText'] = Zurmo::t('Core', 'Hour');
$this->options['minuteText'] = Zurmo::t('Core', 'Minute');
$this->options['secondText'] = Zurmo::t('Core', 'Second');
$this->options['showOn'] = 'both';
$this->options['buttonText'] = ZurmoHtml::tag('span', array(), '<!--Date-->');
$this->options['buttonImageOnly'] = false;
$this->options['timeFormat'] = $this->getTimeFormat();
$this->options['dateFormat'] = YiiToJqueryUIDatePickerLocalization::resolveDateFormat(DateTimeUtil::getLocaleDateFormatForInput());
}
示例3: testCreateAnAccountUserAfterTheCustomFieldsArePlacedForAccountsModule
public function testCreateAnAccountUserAfterTheCustomFieldsArePlacedForAccountsModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Set the date and datetime variable values here
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
//Create a new account based on the custom fields.
$this->resetGetArray();
$this->setPostArray(array('Account' => array('name' => 'myNewAccount', 'officePhone' => '259-784-2169', 'industry' => array('value' => 'Automotive'), 'officeFax' => '299-845-7863', 'employees' => '930', 'annualRevenue' => '474000000', 'type' => array('value' => 'Prospect'), 'website' => 'http://www.Unnamed.com', 'primaryEmail' => array('emailAddress' => 'info@myNewAccount.com', 'optOut' => '1', 'isInvalid' => '0'), 'secondaryEmail' => array('emailAddress' => '', 'optOut' => '0', 'isInvalid' => '0'), 'billingAddress' => array('street1' => '6466 South Madison Creek', 'street2' => '', 'city' => 'Chicago', 'state' => 'IL', 'postalCode' => '60652', 'country' => 'USA'), 'shippingAddress' => array('street1' => '27054 West Michigan Lane', 'street2' => '', 'city' => 'Austin', 'state' => 'TX', 'postalCode' => '78759', 'country' => 'USA'), 'description' => 'This is a Description', 'explicitReadWriteModelPermissions' => array('type' => null), 'datenotreqCstm' => $date)));
$this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/create');
//Check the details if they are saved properly for the custom fields.
$account = Account::getByName('myNewAccount');
//Retrieve the permission for the account.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($account[0]->id));
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals(1, count($account));
$this->assertEquals($account[0]->name, 'myNewAccount');
$this->assertEquals($account[0]->officePhone, '259-784-2169');
$this->assertEquals($account[0]->industry->value, 'Automotive');
$this->assertEquals($account[0]->officeFax, '299-845-7863');
$this->assertEquals($account[0]->employees, '930');
$this->assertEquals($account[0]->annualRevenue, '474000000');
$this->assertEquals($account[0]->type->value, 'Prospect');
$this->assertEquals($account[0]->website, 'http://www.Unnamed.com');
$this->assertEquals($account[0]->primaryEmail->emailAddress, 'info@myNewAccount.com');
$this->assertEquals($account[0]->primaryEmail->optOut, '1');
$this->assertEquals($account[0]->primaryEmail->isInvalid, '0');
$this->assertEquals($account[0]->secondaryEmail->emailAddress, '');
$this->assertEquals($account[0]->secondaryEmail->optOut, '0');
$this->assertEquals($account[0]->secondaryEmail->isInvalid, '0');
$this->assertEquals($account[0]->billingAddress->street1, '6466 South Madison Creek');
$this->assertEquals($account[0]->billingAddress->street2, '');
$this->assertEquals($account[0]->billingAddress->city, 'Chicago');
$this->assertEquals($account[0]->billingAddress->state, 'IL');
$this->assertEquals($account[0]->billingAddress->postalCode, '60652');
$this->assertEquals($account[0]->billingAddress->country, 'USA');
$this->assertEquals($account[0]->shippingAddress->street1, '27054 West Michigan Lane');
$this->assertEquals($account[0]->shippingAddress->street2, '');
$this->assertEquals($account[0]->shippingAddress->city, 'Austin');
$this->assertEquals($account[0]->shippingAddress->state, 'TX');
$this->assertEquals($account[0]->shippingAddress->postalCode, '78759');
$this->assertEquals($account[0]->shippingAddress->country, 'USA');
$this->assertEquals($account[0]->description, 'This is a Description');
$this->assertEquals(0, count($readWritePermitables));
$this->assertEquals(0, count($readOnlyPermitables));
$this->assertEquals($account[0]->datenotreqCstm, $dateAssert);
}
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:49,代码来源:AccountsSuperUserCustomDateNullValueBugWalkthroughTest.php
示例4: testEditOfTheProjectForTheCustomFieldsPlacedForProjectsModule
/**
* @depends testEditOfTheProjectForTheTagCloudFieldAfterRemovingAllTagsPlacedForProjectsModule
*/
public function testEditOfTheProjectForTheCustomFieldsPlacedForProjectsModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Set the date and datetime variable values here.
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
$datetimeAssert = date('Y-m-d H:i:') . "00";
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
//Retrieve the account id, the super user id and project Id.
$superUserId = $super->id;
$explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
$project = Project::getByName('myEditProject');
$projectId = $project[0]->id;
//Edit a new Project based on the custom fields.
$this->setGetArray(array('id' => $projectId));
$this->setPostArray(array('Project' => array('name' => 'myEditProject', 'owner' => array('id' => $superUserId), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'decimalCstm' => '12', 'dateCstm' => $date, 'datetimeCstm' => $datetime, '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')));
$this->runControllerWithRedirectExceptionAndGetUrl('projects/default/edit');
//Check the details if they are saved properly for the custom fields.
$projectId = self::getModelIdByModelNameAndName('Project', 'myEditProject');
$project = Project::getById($projectId);
//Retrieve the permission of the project.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($project);
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals($project->name, 'myEditProject');
$this->assertEquals($project->owner->id, $superUserId);
$this->assertEquals(1, count($readWritePermitables));
$this->assertEquals(0, count($readOnlyPermitables));
$this->assertEquals($project->checkboxCstm, '0');
$this->assertEquals($project->currencyCstm->value, 40);
$this->assertEquals($project->currencyCstm->currency->id, $baseCurrency->id);
$this->assertEquals($project->dateCstm, $dateAssert);
$this->assertEquals($project->datetimeCstm, $datetimeAssert);
$this->assertEquals($project->decimalCstm, '12');
$this->assertEquals($project->picklistCstm->value, 'b');
$this->assertEquals($project->integerCstm, 11);
$this->assertEquals($project->phoneCstm, '259-784-2069');
$this->assertEquals($project->radioCstm->value, 'e');
$this->assertEquals($project->textCstm, 'This is a test Edit Text');
$this->assertEquals($project->textareaCstm, 'This is a test Edit TextArea');
$this->assertEquals($project->urlCstm, 'http://wwww.abc-edit.com');
$this->assertEquals($project->dateCstm, $dateAssert);
$this->assertEquals($project->datetimeCstm, $datetimeAssert);
$this->assertEquals($project->countrylistCstm->value, 'aaaa');
$this->assertEquals($project->statelistCstm->value, 'aaa1');
$this->assertEquals($project->citylistCstm->value, 'ab1');
$this->assertContains('gg', $project->multiselectCstm->values);
$this->assertContains('hh', $project->multiselectCstm->values);
$this->assertContains('reading', $project->tagcloudCstm->values);
$this->assertContains('surfing', $project->tagcloudCstm->values);
$metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Project');
$testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $project);
$this->assertEquals(132, intval(str_replace(',', '', $testCalculatedValue)));
// Not Coding Standard
}
示例5: testEditOfTheProductTemplateForTheCustomFieldsPlacedForProductTemplatesModule
/**
* @depends testEditOfTheProductTemplateForTheTagCloudFieldAfterRemovingAllTagsPlacedForProductTemplatesModule
*/
public function testEditOfTheProductTemplateForTheCustomFieldsPlacedForProductTemplatesModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Set the date and datetime variable values here.
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
$datetimeAssert = date('Y-m-d H:i:') . "00";
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
//Retrieve the account id, the super user id and opportunity Id.
$superUserId = $super->id;
$productTemplate = ProductTemplate::getByName('myEditProductTemplate');
$productTemplateId = $productTemplate[0]->id;
//Edit a new ProductTemplate based on the custom fields.
$this->setGetArray(array('id' => $productTemplateId));
$this->setPostArray(array('ProductTemplate' => array('name' => 'myEditProductTemplate', 'type' => ProductTemplate::TYPE_PRODUCT, 'description' => 'Test Description', 'sellPrice' => array('currency' => array('id' => $baseCurrency->id), 'value' => 200), 'cost' => array('currency' => array('id' => $baseCurrency->id), 'value' => 200), 'listPrice' => array('currency' => array('id' => $baseCurrency->id), 'value' => 200), 'priceFrequency' => 2, 'status' => ProductTemplate::STATUS_ACTIVE, 'sellPriceFormula' => array('type' => SellPriceFormula::TYPE_EDITABLE), 'checkboxCstm' => '0', 'currencyCstm' => array('value' => 40, 'currency' => array('id' => $baseCurrency->id)), 'decimalCstm' => '12', 'dateCstm' => $date, 'datetimeCstm' => $datetime, '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')));
$this->runControllerWithRedirectExceptionAndGetUrl('productTemplates/default/edit');
//Check the details if they are saved properly for the custom fields.
$productTemplateId = self::getModelIdByModelNameAndName('ProductTemplate', 'myEditProductTemplate');
$productTemplate = ProductTemplate::getById($productTemplateId);
$this->assertEquals($productTemplate->name, 'myEditProductTemplate');
$this->assertEquals($productTemplate->sellPrice->value, 200.0);
$this->assertEquals($productTemplate->cost->value, 200.0);
$this->assertEquals($productTemplate->listPrice->value, 200.0);
$this->assertEquals($productTemplate->description, 'Test Description');
$this->assertEquals($productTemplate->type, ProductTemplate::TYPE_PRODUCT);
$this->assertEquals($productTemplate->status, ProductTemplate::STATUS_ACTIVE);
$this->assertEquals($productTemplate->priceFrequency, 2);
$this->assertEquals($productTemplate->sellPriceFormula->type, SellPriceFormula::TYPE_EDITABLE);
$this->assertEquals($productTemplate->checkboxCstm, '0');
$this->assertEquals($productTemplate->currencyCstm->value, 40);
$this->assertEquals($productTemplate->currencyCstm->currency->id, $baseCurrency->id);
$this->assertEquals($productTemplate->dateCstm, $dateAssert);
$this->assertEquals($productTemplate->datetimeCstm, $datetimeAssert);
$this->assertEquals($productTemplate->decimalCstm, '12');
$this->assertEquals($productTemplate->picklistCstm->value, 'b');
$this->assertEquals($productTemplate->integerCstm, 11);
$this->assertEquals($productTemplate->phoneCstm, '259-784-2069');
$this->assertEquals($productTemplate->radioCstm->value, 'e');
$this->assertEquals($productTemplate->textCstm, 'This is a test Edit Text');
$this->assertEquals($productTemplate->textareaCstm, 'This is a test Edit TextArea');
$this->assertEquals($productTemplate->urlCstm, 'http://wwww.abc-edit.com');
$this->assertEquals($productTemplate->dateCstm, $dateAssert);
$this->assertEquals($productTemplate->datetimeCstm, $datetimeAssert);
$this->assertEquals($productTemplate->countrylistCstm->value, 'aaaa');
$this->assertEquals($productTemplate->statelistCstm->value, 'aaa1');
$this->assertEquals($productTemplate->citylistCstm->value, 'ab1');
$this->assertContains('gg', $productTemplate->multiselectCstm->values);
$this->assertContains('hh', $productTemplate->multiselectCstm->values);
$this->assertContains('reading', $productTemplate->tagcloudCstm->values);
$this->assertContains('surfing', $productTemplate->tagcloudCstm->values);
$metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'ProductTemplate');
$testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $productTemplate);
$this->assertEquals(132, intval(str_replace(',', "", $testCalculatedValue)));
// Not Coding Standard
}
示例6: testEditOfTheLeadUserForTheCustomFieldsPlacedForLeadsModule
/**
* @depends testEditOfTheLeadUserForTheTagCloudFieldAfterRemovingAllTagsPlacedForLeadsModule
*/
public function testEditOfTheLeadUserForTheCustomFieldsPlacedForLeadsModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Retrieve the the super user id.
$superUserId = $super->id;
//Retrieve the lead id.
$leadId = self::getModelIdByModelNameAndName('Contact', 'Sarah Williams Edit');
//Set the date and datetime variable values here.
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
$datetimeAssert = date('Y-m-d H:i:') . "00";
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
//Retrieve the Lead State (Status) Id based on the name.
$leadState = ContactState::getByName('In Progress');
$leadStateId = $leadState[0]->id;
$explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
//Edit and save the lead.
$this->setGetArray(array('id' => $leadId));
$this->setPostArray(array('Contact' => array('title' => array('value' => 'Mrs.'), 'firstName' => 'Sarah', 'lastName' => 'Williams Edit', 'jobTitle' => 'Sales Director Edit', 'companyName' => 'ABC Telecom Edit', 'industry' => array('value' => 'Banking'), 'website' => 'http://www.companyedit.com', 'department' => 'Sales Edit', 'officePhone' => '739-742-3005', 'source' => array('value' => 'Inbound Call'), 'mobilePhone' => '285-300-8232', 'officeFax' => '255-454-1914', 'state' => array('id' => $leadStateId), 'owner' => array('id' => $superUserId), 'primaryEmail' => array('emailAddress' => 'info@myNewLead.com', 'optOut' => '0', 'isInvalid' => '0'), 'secondaryEmail' => array('emailAddress' => 'info@myNewLeadEdit.com', 'optOut' => '0', 'isInvalid' => '0'), 'primaryAddress' => array('street1' => '26378 South Arlington Ave', 'street2' => '', 'city' => 'San Jose', 'state' => 'CA', 'postalCode' => '95131', 'country' => 'USA'), 'secondaryAddress' => array('street1' => '1652 North Cedar Court', 'street2' => '', 'city' => 'Phoenix', 'state' => 'AZ', 'postalCode' => '85003', 'country' => 'USA'), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), 'description' => 'This is a Edit Description', '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'), 'save' => 'Save'));
$this->runControllerWithRedirectExceptionAndGetUrl('leads/default/edit');
//Check the details if they are saved properly for the custom fields after the edit.
$lead = Contact::getById($leadId);
//Retrieve the permission of the lead.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem($lead);
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals($lead->title->value, 'Mrs.');
$this->assertEquals($lead->firstName, 'Sarah');
$this->assertEquals($lead->lastName, 'Williams Edit');
$this->assertEquals($lead->state->id, $leadStateId);
$this->assertEquals($lead->jobTitle, 'Sales Director Edit');
$this->assertEquals($lead->companyName, 'ABC Telecom Edit');
$this->assertEquals($lead->industry->value, 'Banking');
$this->assertEquals($lead->website, 'http://www.companyedit.com');
$this->assertEquals($lead->department, 'Sales Edit');
$this->assertEquals($lead->officePhone, '739-742-3005');
$this->assertEquals($lead->source->value, 'Inbound Call');
$this->assertEquals($lead->mobilePhone, '285-300-8232');
$this->assertEquals($lead->officeFax, '255-454-1914');
$this->assertEquals($lead->primaryEmail->emailAddress, 'info@myNewLead.com');
$this->assertEquals($lead->primaryEmail->optOut, '0');
$this->assertEquals($lead->primaryEmail->isInvalid, '0');
$this->assertEquals($lead->secondaryEmail->emailAddress, 'info@myNewLeadEdit.com');
$this->assertEquals($lead->secondaryEmail->optOut, '0');
$this->assertEquals($lead->secondaryEmail->isInvalid, '0');
$this->assertEquals($lead->primaryAddress->street1, '26378 South Arlington Ave');
$this->assertEquals($lead->primaryAddress->street2, '');
$this->assertEquals($lead->primaryAddress->city, 'San Jose');
$this->assertEquals($lead->primaryAddress->state, 'CA');
$this->assertEquals($lead->primaryAddress->postalCode, '95131');
$this->assertEquals($lead->primaryAddress->country, 'USA');
$this->assertEquals($lead->secondaryAddress->street1, '1652 North Cedar Court');
$this->assertEquals($lead->secondaryAddress->street2, '');
$this->assertEquals($lead->secondaryAddress->city, 'Phoenix');
$this->assertEquals($lead->secondaryAddress->state, 'AZ');
$this->assertEquals($lead->secondaryAddress->postalCode, '85003');
$this->assertEquals($lead->secondaryAddress->country, 'USA');
$this->assertEquals(1, count($readWritePermitables));
$this->assertEquals(0, count($readOnlyPermitables));
$this->assertEquals($lead->description, 'This is a Edit Description');
$this->assertEquals($lead->checkboxCstm, '0');
$this->assertEquals($lead->currencyCstm->value, 40);
$this->assertEquals($lead->currencyCstm->currency->id, $baseCurrency->id);
$this->assertEquals($lead->dateCstm, $dateAssert);
$this->assertEquals($lead->datetimeCstm, $datetimeAssert);
$this->assertEquals($lead->decimalCstm, '12');
$this->assertEquals($lead->picklistCstm->value, 'b');
$this->assertEquals($lead->integerCstm, 11);
$this->assertEquals($lead->phoneCstm, '259-784-2069');
$this->assertEquals($lead->radioCstm->value, 'e');
$this->assertEquals($lead->textCstm, 'This is a test Edit Text');
$this->assertEquals($lead->textareaCstm, 'This is a test Edit TextArea');
$this->assertEquals($lead->urlCstm, 'http://wwww.abc-edit.com');
$this->assertEquals($lead->countrylistCstm->value, 'aaaa');
$this->assertEquals($lead->statelistCstm->value, 'aaa1');
$this->assertEquals($lead->citylistCstm->value, 'ab1');
$this->assertContains('gg', $lead->multiselectCstm->values);
$this->assertContains('hh', $lead->multiselectCstm->values);
$this->assertContains('reading', $lead->tagcloudCstm->values);
$this->assertContains('surfing', $lead->tagcloudCstm->values);
$metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Contact');
$testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $lead);
$this->assertEquals(23, $testCalculatedValue);
}
示例7: testEditOfTheMeetingForTheCustomFieldsPlacedForMeetingsModule
/**
* @depends testEditOfTheMeetingForTheTagCloudFieldAfterRemovingAllTagsPlacedForMeetingsModule
*/
public function testEditOfTheMeetingForTheCustomFieldsPlacedForMeetingsModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Retrieve the meeting Id.
$meeting = Meeting::getByName('myEditMeeting');
//Set the date and datetime variable values here.
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), 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');
$superContactId1 = self::getModelIdByModelNameAndName('Contact', 'superContact1 superContact1son');
$superContactId2 = self::getModelIdByModelNameAndName('Contact', 'superContact2 superContact2son');
$superContactId3 = self::getModelIdByModelNameAndName('Contact', 'superContact3 superContact3son');
$superOpportunityId = self::getModelIdByModelNameAndName('Opportunity', 'superOpp');
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
$explicitReadWriteModelPermission = ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP;
$activityItemFormContacts = $superContactId1 . ',' . $superContactId2 . ',' . $superContactId3;
// Not Coding Standard
//Edit the meeting based on the custom fields and the meeting Id.
$this->setGetArray(array('id' => $meeting[0]->id));
$this->setPostArray(array('Meeting' => array('name' => 'myEditMeeting', 'location' => 'LandLine', 'startDateTime' => $datetime, 'endDateTime' => $datetime, 'category' => array('value' => 'Call'), 'description' => 'This is Edit Meeting Description', 'owner' => array('id' => $superUserId), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), '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('ids' => $activityItemFormContacts), 'Opportunity' => array('id' => $superOpportunityId))));
$this->runControllerWithRedirectExceptionAndGetUrl('meetings/default/edit');
//Check the details if they are saved properly for the custom fields.
$meeting = Meeting::getByName('myEditMeeting');
//Retrieve the permission of the meeting.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Meeting::getById($meeting[0]->id));
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals($meeting[0]->name, 'myEditMeeting');
$this->assertEquals($meeting[0]->location, 'LandLine');
$this->assertEquals($meeting[0]->startDateTime, $datetimeAssert);
$this->assertEquals($meeting[0]->endDateTime, $datetimeAssert);
$this->assertEquals($meeting[0]->category->value, 'Call');
$this->assertEquals($meeting[0]->description, 'This is Edit Meeting Description');
$this->assertEquals($meeting[0]->owner->id, $superUserId);
$this->assertEquals($meeting[0]->activityItems->count(), 5);
$this->assertEquals(1, count($readWritePermitables));
$this->assertEquals(0, count($readOnlyPermitables));
$this->assertEquals($meeting[0]->checkboxCstm, '0');
$this->assertEquals($meeting[0]->currencyCstm->value, 40);
$this->assertEquals($meeting[0]->currencyCstm->currency->id, $baseCurrency->id);
$this->assertEquals($meeting[0]->dateCstm, $dateAssert);
$this->assertEquals($meeting[0]->datetimeCstm, $datetimeAssert);
$this->assertEquals($meeting[0]->decimalCstm, '12');
$this->assertEquals($meeting[0]->picklistCstm->value, 'b');
$this->assertEquals($meeting[0]->integerCstm, 11);
$this->assertEquals($meeting[0]->phoneCstm, '259-784-2069');
$this->assertEquals($meeting[0]->radioCstm->value, 'e');
$this->assertEquals($meeting[0]->textCstm, 'This is a test Edit Text');
$this->assertEquals($meeting[0]->textareaCstm, 'This is a test Edit TextArea');
$this->assertEquals($meeting[0]->urlCstm, 'http://wwww.abc-edit.com');
$this->assertEquals($meeting[0]->countrylistCstm->value, 'aaaa');
$this->assertEquals($meeting[0]->statelistCstm->value, 'aaa1');
$this->assertEquals($meeting[0]->citylistCstm->value, 'ab1');
$this->assertContains('gg', $meeting[0]->multiselectCstm->values);
$this->assertContains('hh', $meeting[0]->multiselectCstm->values);
$this->assertContains('reading', $meeting[0]->tagcloudCstm->values);
$this->assertContains('surfing', $meeting[0]->tagcloudCstm->values);
$metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Meeting');
$testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $meeting[0]);
$this->assertEquals(1, $testCalculatedValue);
}
示例8: testEditOfTheTaskForTheCustomFieldsPlacedForTasksModule
/**
* @depends testEditOfTheTaskForTheTagCloudFieldAfterRemovingAllTagsPlacedForTasksModule
*/
public function testEditOfTheTaskForTheCustomFieldsPlacedForTasksModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Retrieve the task Id.
$task = Task::getByName('myEditTask');
//Set the date and datetime variable values here.
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), 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;
//Edit the task based on the custom fields and the task id.
$this->setGetArray(array('id' => $task[0]->id));
$this->setPostArray(array('Task' => array('name' => 'myEditTask', 'dueDateTime' => $datetime, 'status' => Task::STATUS_COMPLETED, 'description' => 'This is edit task Description', 'owner' => array('id' => $superUserId), 'explicitReadWriteModelPermissions' => array('type' => $explicitReadWriteModelPermission), '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'), 'TaskActivityItemForm' => array('Account' => array('id' => $superAccount[0]->id), 'Contact' => array('id' => $superContactId), 'Opportunity' => array('id' => $superOpportunityId)), 'save' => 'Save'));
$this->runControllerWithNoExceptionsAndGetContent('tasks/default/modalSave');
//Check the details if they are saved properly for the custom fields.
$task = Task::getByName('myEditTask');
//Retrieve the permission of the task.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Task::getById($task[0]->id));
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals($task[0]->name, 'myEditTask');
$this->assertEquals($task[0]->dueDateTime, $datetimeAssert);
$this->assertTrue((bool) $task[0]->completed);
$this->assertNotNull($task[0]->completedDateTime);
$this->assertEquals($task[0]->description, 'This is edit task Description');
$this->assertEquals($task[0]->owner->id, $superUserId);
$this->assertEquals($task[0]->activityItems->count(), 3);
$this->assertEquals(1, count($readWritePermitables));
$this->assertEquals(0, count($readOnlyPermitables));
$this->assertEquals($task[0]->checkboxCstm, '0');
$this->assertEquals($task[0]->currencyCstm->value, 40);
$this->assertEquals($task[0]->currencyCstm->currency->id, $baseCurrency->id);
$this->assertEquals($task[0]->dateCstm, $dateAssert);
$this->assertEquals($task[0]->datetimeCstm, $datetimeAssert);
$this->assertEquals($task[0]->decimalCstm, '12');
$this->assertEquals($task[0]->picklistCstm->value, 'b');
$this->assertEquals($task[0]->integerCstm, 11);
$this->assertEquals($task[0]->phoneCstm, '259-784-2069');
$this->assertEquals($task[0]->radioCstm->value, 'e');
$this->assertEquals($task[0]->textCstm, 'This is a test Edit Text');
$this->assertEquals($task[0]->textareaCstm, 'This is a test Edit TextArea');
$this->assertEquals($task[0]->urlCstm, 'http://wwww.abc-edit.com');
$this->assertEquals($task[0]->countrylistCstm->value, 'aaaa');
$this->assertEquals($task[0]->statelistCstm->value, 'aaa1');
$this->assertEquals($task[0]->citylistCstm->value, 'ab1');
$this->assertContains('gg', $task[0]->multiselectCstm->values);
$this->assertContains('hh', $task[0]->multiselectCstm->values);
$this->assertContains('reading', $task[0]->tagcloudCstm->values);
$this->assertContains('surfing', $task[0]->tagcloudCstm->values);
$metadata = CalculatedDerivedAttributeMetadata::getByNameAndModelClassName('calcnumber', 'Task');
$testCalculatedValue = CalculatedNumberUtil::calculateByFormulaAndModelAndResolveFormat($metadata->getFormula(), $task[0]);
$this->assertEquals(132, $testCalculatedValue);
}
示例9: testMultiValueCustomFieldContentAfterCreateAndEditPlacedForAccountsModule
/**
* @depends testCreateSecondAccountForUserAfterTheCustomFieldsArePlacedForAccountsModule
*/
public function testMultiValueCustomFieldContentAfterCreateAndEditPlacedForAccountsModule()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
//Set the date and datetime variable values here
$date = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateFormatForInput(), time());
$dateAssert = date('Y-m-d');
$datetime = Yii::app()->dateFormatter->format(DateTimeUtil::getLocaleDateTimeFormatForInput(), time());
$datetimeAssert = date('Y-m-d H:i:') . "00";
$baseCurrency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
//Create a new account based on the custom fields.
$this->resetGetArray();
$this->setPostArray(array('Account' => array('name' => 'myThirdAccount', 'officePhone' => '259-784-2169', 'industry' => array('value' => 'Automotive'), 'officeFax' => '299-845-7863', 'employees' => '930', 'annualRevenue' => '474000000', 'type' => array('value' => 'Prospect'), 'website' => 'http://www.Unnamed.com', 'primaryEmail' => array('emailAddress' => 'info@myNewAccount.com', 'optOut' => '1', 'isInvalid' => '0'), 'secondaryEmail' => array('emailAddress' => '', 'optOut' => '0', 'isInvalid' => '0'), 'billingAddress' => array('street1' => '6466 South Madison Creek', 'street2' => '', 'city' => 'Chicago', 'state' => 'IL', 'postalCode' => '60652', 'country' => 'USA'), 'shippingAddress' => array('street1' => '27054 West Michigan Lane', 'street2' => '', 'city' => 'Austin', 'state' => 'TX', 'postalCode' => '78759', 'country' => 'USA'), 'description' => 'This is a Description', 'explicitReadWriteModelPermissions' => array('type' => null), 'checkboxCstm' => '1', 'currencyCstm' => array('value' => 45, 'currency' => array('id' => $baseCurrency->id)), 'dateCstm' => $date, 'datetimeCstm' => $datetime, 'decimalCstm' => '123', 'picklistCstm' => array('value' => 'a'), 'multiselectCstm' => array('values' => array('gg', 'ff')), 'tagcloudCstm' => array('values' => array('reading', 'writing')), 'countrylistCstm' => array('value' => 'bbbb'), 'statelistCstm' => array('value' => 'bbb1'), 'citylistCstm' => array('value' => 'bb1'), 'integerCstm' => '12', 'phoneCstm' => '259-784-2169', 'radioCstm' => array('value' => 'd'), 'textCstm' => 'This is a test Text', 'textareaCstm' => 'This is a test TextArea', 'urlCstm' => 'http://wwww.abc.com')));
$this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/create');
//Check the details if they are saved properly for the custom fields.
$account = Account::getByName('myThirdAccount');
//Retrieve the permission for the account.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($account[0]->id));
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals(1, count($account));
$this->assertEquals($account[0]->name, 'myThirdAccount');
$this->assertEquals(2, $account[0]->multiselectCstm->values->count());
$this->assertEquals(2, $account[0]->tagcloudCstm->values->count());
$this->assertContains('gg', $account[0]->multiselectCstm->values);
$this->assertContains('ff', $account[0]->multiselectCstm->values);
$this->assertContains('reading', $account[0]->tagcloudCstm->values);
$this->assertContains('writing', $account[0]->tagcloudCstm->values);
unset($account);
$account = Account::getByName('myThirdAccount');
$accountId = $account[0]->id;
//Edit and save the account.
$this->setGetArray(array('id' => $accountId));
$this->setPostArray(array('Account' => array('name' => 'myThirdAccount', 'multiselectCstm' => array('values' => array('ff')), 'tagcloudCstm' => array('values' => array('writing'))), 'save' => 'Save'));
$this->runControllerWithRedirectExceptionAndGetUrl('accounts/default/edit');
//Check the details if they are saved properly for the custom fields.
$account = Account::getByName('myThirdAccount');
//Retrieve the permission for the account.
$explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($account[0]->id));
$readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
$readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
$this->assertEquals(1, count($account));
$this->assertEquals(1, $account[0]->multiselectCstm->values->count());
$this->assertContains('ff', $account[0]->multiselectCstm->values);
$this->assertNotContains('gg', $account[0]->multiselectCstm->values);
$this->assertNotContains('hh', $account[0]->multiselectCstm->values);
$this->assertNotContains('rr', $account[0]->multiselectCstm->values);
$this->assertEquals(1, $account[0]->tagcloudCstm->values->count());
$this->assertContains('writing', $account[0]->tagcloudCstm->values);
}
示例10: resolveValueForDateDBFormatted
public static function resolveValueForDateDBFormatted($value)
{
if ($value == null) {
return null;
}
$localeDateFormat = DateTimeUtil::getLocaleDateFormatForInput();
return Yii::app()->dateFormatter->format(DatabaseCompatibilityUtil::getDateFormat(), CDateTimeParser::parse($value, $localeDateFormat));
}
示例11: testGetLocaleDateFormatForInput
public function testGetLocaleDateFormatForInput()
{
$timeZone = date_default_timezone_get();
date_default_timezone_set('GMT');
$localDateFormatForInput = DateTimeUtil::getLocaleDateFormatForInput();
$this->assertEquals('M/d/yyyy', $localDateFormatForInput);
//other locales
Yii::app()->setLanguage('de');
$localDateFormatForInput = DateTimeUtil::getLocaleDateFormatForInput();
$this->assertEquals('dd.MM.yyyy', $localDateFormatForInput);
Yii::app()->setLanguage('it');
$localDateFormatForInput = DateTimeUtil::getLocaleDateFormatForInput();
$this->assertEquals('dd/MM/yyyy', $localDateFormatForInput);
Yii::app()->setLanguage('fr');
$localDateFormatForInput = DateTimeUtil::getLocaleDateFormatForInput();
$this->assertEquals('dd/MM/yyyy', $localDateFormatForInput);
date_default_timezone_set($timeZone);
}