當前位置: 首頁>>代碼示例>>PHP>>正文


PHP ContactState::getCount方法代碼示例

本文整理匯總了PHP中ContactState::getCount方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContactState::getCount方法的具體用法?PHP ContactState::getCount怎麽用?PHP ContactState::getCount使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在ContactState的用法示例。


在下文中一共展示了ContactState::getCount方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testLoad

 public function testLoad()
 {
     $customFieldData = CustomFieldData::getByName('Titles');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('AccountTypes');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('LeadSources');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('Industries');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('MeetingCategories');
     $this->assertEquals(0, count(unserialize($customFieldData->serializedData)));
     $this->assertEquals(0, ContactState::getCount());
     // do a getAll to ensure we create base currency
     $baseCurrency = Currency::getAll();
     $this->assertCount(1, $baseCurrency);
     $this->assertEquals(1, Currency::getCount());
     $messageLogger = new MessageLogger();
     DefaultDataUtil::load($messageLogger);
     $customFieldData = CustomFieldData::getByName('Titles');
     $this->assertEquals(4, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('AccountTypes');
     $this->assertEquals(3, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('LeadSources');
     $this->assertEquals(4, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('Industries');
     $this->assertEquals(9, count(unserialize($customFieldData->serializedData)));
     $customFieldData = CustomFieldData::getByName('MeetingCategories');
     $this->assertEquals(2, count(unserialize($customFieldData->serializedData)));
     $this->assertEquals(6, ContactState::getCount());
     $this->assertEquals(1, Currency::getCount());
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:32,代碼來源:DefaultDataUtilTest.php

示例2: testContactStateModelAttributesAdapter

 public function testContactStateModelAttributesAdapter()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $this->assertTrue(ContactsModule::loadStartingData());
     $this->assertEquals(6, count(ContactState::GetAll()));
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Contact(), 'state');
     $compareData = array(0 => 'New', 1 => 'In Progress', 2 => 'Recycled', 3 => 'Dead', 4 => 'Qualified', 5 => 'Customer');
     $this->assertEquals($compareData, $attributeForm->contactStatesData);
     $this->assertEquals(null, $attributeForm->contactStatesLabels);
     $this->assertEquals(4, $attributeForm->startingStateOrder);
     //Now add new values.
     $attributeForm->contactStatesData = array(0 => 'New', 1 => 'In Progress', 2 => 'Recycled', 3 => 'Dead', 4 => 'Qualified', 5 => 'Customer', 6 => 'AAA', 7 => 'BBB');
     $contactStatesLabels = array('fr' => array('New', 'In ProgressFr', 'RecycledFr', 'DeadFr', 'QualifiedFr', 'CustomerFr', 'AAAFr', 'BBBFr'));
     $attributeForm->contactStatesLabels = $contactStatesLabels;
     $attributeForm->startingStateOrder = 5;
     $adapter = new ContactStateModelAttributesAdapter(new Contact());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Contact(), 'state');
     $compareData = array(0 => 'New', 1 => 'In Progress', 2 => 'Recycled', 3 => 'Dead', 4 => 'Qualified', 5 => 'Customer', 6 => 'AAA', 7 => 'BBB');
     $this->assertEquals($compareData, $attributeForm->contactStatesData);
     $this->assertEquals($contactStatesLabels, $attributeForm->contactStatesLabels);
     $contactState = ContactState::getByName('Customer');
     $this->assertEquals(5, $contactState[0]->order);
     $this->assertEquals(5, $attributeForm->startingStateOrder);
     //Test removing existing values.
     $attributeForm->contactStatesData = array(0 => 'New', 1 => 'In Progress', 2 => 'Recycled', 3 => 'Customer', 4 => 'AAA', 5 => 'BBB');
     $attributeForm->startingStateOrder = 5;
     $adapter = new ContactStateModelAttributesAdapter(new Contact());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Contact(), 'state');
     $compareData = array(0 => 'New', 1 => 'In Progress', 2 => 'Recycled', 3 => 'Customer', 4 => 'AAA', 5 => 'BBB');
     $this->assertEquals($compareData, $attributeForm->contactStatesData);
     $this->assertEquals(5, $attributeForm->startingStateOrder);
     //Test switching order of existing values.
     $attributeForm->contactStatesData = array(0 => 'New', 3 => 'In Progress', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB');
     $attributeForm->startingStateOrder = 2;
     $adapter = new ContactStateModelAttributesAdapter(new Contact());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Contact(), 'state');
     $compareData = array(0 => 'New', 3 => 'In Progress', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB');
     $this->assertEquals($compareData, $attributeForm->contactStatesData);
     $this->assertEquals(2, $attributeForm->startingStateOrder);
     //Test switching order of existing values and adding new values mixed in.
     $attributeForm->contactStatesData = array(3 => 'New', 6 => 'In Progress', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB', 0 => 'CCC');
     $attributeForm->startingStateOrder = 2;
     $adapter = new ContactStateModelAttributesAdapter(new Contact());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Contact(), 'state');
     $compareData = array(3 => 'New', 6 => 'In Progress', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB', 0 => 'CCC');
     $this->assertEquals($compareData, $attributeForm->contactStatesData);
     $this->assertEquals(2, $attributeForm->startingStateOrder);
     //Switching name of existing state
     $this->assertEquals(7, ContactState::getCount());
     $attributeForm->contactStatesDataExistingValues = array(3 => 'New', 6 => 'In Progress', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB', 0 => 'CCC');
     $attributeForm->contactStatesData = array(3 => 'New', 6 => 'In Progress Plastic', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB', 0 => 'CCC');
     $attributeForm->startingStateOrder = 2;
     $adapter = new ContactStateModelAttributesAdapter(new Contact());
     $adapter->setAttributeMetadataFromForm($attributeForm);
     $attributeForm = AttributesFormFactory::createAttributeFormByAttributeName(new Contact(), 'state');
     $compareData = array(3 => 'New', 6 => 'In Progress Plastic', 5 => 'Recycled', 1 => 'Customer', 4 => 'AAA', 2 => 'BBB', 0 => 'CCC');
     $this->assertEquals($compareData, $attributeForm->contactStatesData);
     $this->assertEquals(2, $attributeForm->startingStateOrder);
     $this->assertEquals(7, ContactState::getCount());
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:64,代碼來源:ContactStateTest.php


注:本文中的ContactState::getCount方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。