当前位置: 首页>>代码示例>>PHP>>正文


PHP CContact::overrideDatabase方法代码示例

本文整理汇总了PHP中CContact::overrideDatabase方法的典型用法代码示例。如果您正苦于以下问题:PHP CContact::overrideDatabase方法的具体用法?PHP CContact::overrideDatabase怎么用?PHP CContact::overrideDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CContact的用法示例。


在下文中一共展示了CContact::overrideDatabase方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testStoreCreate

 /**
  * Tests the proper creation of a user & contact
  */
 public function testStoreCreate()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $contact = new CContact();
     $contact->overrideDatabase($this->mockDB);
     $contact->bind($this->post_data);
     $result = $contact->store();
     $this->assertTrue($result);
     $this->assertNotEquals(0, $contact->contact_id);
     $this->obj->user_contact = $contact->contact_id;
     $result = $this->obj->store();
     $this->assertTrue($result);
     $this->assertNotEquals(0, $this->obj->user_id);
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:18,代码来源:CUsersTest.php

示例2: testLoad

 public function testLoad()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $item = new CContact();
     $item->overrideDatabase($this->mockDB);
     $this->post_data['contact_id'] = $this->obj->contact_id;
     $this->mockDB->stageHash($this->post_data);
     $item->load($this->obj->contact_id);
     $this->assertEquals($this->obj->contact_first_name, $item->contact_first_name);
     $this->assertEquals($this->obj->contact_last_name, $item->contact_last_name);
     $this->assertEquals($this->obj->contact_display_name, $item->contact_display_name);
     $this->assertEquals($this->obj->contact_company, $item->contact_company);
     $this->assertEquals($this->obj->contact_department, $item->contact_department);
     $this->assertEquals($this->obj->contact_icon, $item->contact_icon);
     $this->assertEquals($this->obj->contact_owner, $item->contact_owner);
     $this->assertEquals($this->obj->contact_id, $item->contact_id);
 }
开发者ID:,项目名称:,代码行数:19,代码来源:

示例3: hook_cron

 public function hook_cron()
 {
     $q = $this->_getQuery();
     $q->addTable('contacts');
     $q->addQuery('contact_id');
     $q->addWhere('contact_display_name IS NULL OR contact_display_name = ""');
     $contactIdList = $q->loadList();
     foreach ($contactIdList as $contactId) {
         $myContact = new CContact();
         $myContact->overrideDatabase($this->_query);
         $myContact = $myContact->load($contactId['contact_id']);
         $myContact->store();
     }
     //To Bruce: Clean updatekeys based on datediff to warn about long waiting.
     //TODO: This should be converted to a system configuration value
     $days_for_update = 5;
     $this->clearOldUpdatekeys($days_for_update);
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:18,代码来源:contacts.class.php

示例4: testDelete

 public function testDelete()
 {
     $this->obj->bind($this->post_data);
     $result = $this->obj->store();
     $this->assertTrue($result);
     $original_id = $this->obj->contact_id;
     $result = $this->obj->delete();
     $item = new CContact();
     $item->overrideDatabase($this->mockDB);
     $this->mockDB->stageHash(array('contact_first_name' => '', 'contact_display_name' => ''));
     $item->load($original_id);
     $this->assertTrue(is_a($item, 'CContact'));
     $this->assertEquals('', $item->contact_first_name);
     $this->assertEquals('', $item->contact_display_name);
 }
开发者ID:illuminate3,项目名称:web2project,代码行数:15,代码来源:CContactsTest.php


注:本文中的CContact::overrideDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。