当前位置: 首页>>代码示例>>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;未经允许,请勿转载。