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


PHP CComponent::attachBehavior方法代碼示例

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


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

示例1: testBehaviors

 public function testBehaviors()
 {
     $component = new CComponent();
     $hash = new ARedisHash("testAttribute" . uniqid(), $this->getConnection());
     $component->attachBehavior("testAttribute", $hash);
     $this->assertTrue(isset($component->testAttribute));
     $this->assertTrue($component->testAttribute->add("test", true));
     $this->assertTrue((bool) $component->testAttribute['test']);
     $component->testAttribute->clear();
 }
開發者ID:rainsongsky,項目名稱:YiiRedis,代碼行數:10,代碼來源:ARedisHashTest.php

示例2: run

 public function run($args)
 {
     $comp = new CComponent();
     $ubconfig = array_merge(array('class' => 'UpdaterBehavior', 'isConsole' => true, 'noHalt' => true));
     $comp->attachBehavior('UpdaterBehavior', $ubconfig);
     // The files directly involved in the update process:
     $updaterFiles = $comp->updaterFiles;
     // The web-based updater's action classes, which are defined separately:
     $updaterActions = $comp->getWebUpdaterActions(false);
     foreach ($updaterActions as $name => $properties) {
         $updaterFiles[] = UpdaterBehavior::classAliasPath($properties['class']);
     }
     echo "\$deps = ";
     var_export($updaterFiles);
 }
開發者ID:tymiles003,項目名稱:X2CRM,代碼行數:15,代碼來源:UpdaterPackageCommand.php

示例3: instantiate

 public function instantiate()
 {
     $component = new CComponent();
     $component->attachBehavior('messageParser', array('class' => 'X2TranslationBehavior'));
     return $component;
 }
開發者ID:tymiles003,項目名稱:X2CRM,代碼行數:6,代碼來源:X2TranslationBehaviorTest.php

示例4: instantiateUBe

 /**
  * Instantiates a new CComponent object with {@link UpdaterBehavior attached
  * to it, and returns it.
  * @return CComponent
  */
 public function instantiateUBe($properties = array())
 {
     $comp = new CComponent();
     $ubconfig = array_merge(array('class' => 'UpdaterBehavior', 'isConsole' => true, 'noHalt' => true), $properties);
     $comp->attachBehavior('UpdaterBehavior', $ubconfig);
     return $comp;
 }
開發者ID:keyeMyria,項目名稱:CRM,代碼行數:12,代碼來源:UpdaterBehaviorTest.php

示例5: instantiate

 public function instantiate($config = array())
 {
     $obj = new CComponent();
     $obj->attachBehavior('CampaignMailing', array_merge(array('class' => 'CampaignMailingBehavior', 'itemId' => $this->listItem('testUser_unsent')->id, 'campaign' => $this->campaign('testUser')), $config));
     return $obj;
 }
開發者ID:shayanyi,項目名稱:CRM,代碼行數:6,代碼來源:CampaignMailingBehaviorTest.php

示例6: testPrepareExportDeliverable

 /**
  * Verify correct operation of {@link prepareExportDeliverable}.
  * Currently, the exportDestinations with test cases include: download, server, ftp, scp
  * exportDestinations remaining to be tested: s3, gdrive
  */
 public function testPrepareExportDeliverable()
 {
     $component = new CComponent();
     $component->attachBehavior('importexport', new ImportExportBehavior());
     $testfile = implode(DIRECTORY_SEPARATOR, array(Yii::app()->basePath, 'tests', 'data', 'csvs', 'contacts.csv'));
     // Ensure failure when the exportDestination is not specified
     $ret = $component->prepareExportDeliverable($testfile, array());
     $this->assertFalse($ret);
     // Test standard browser download method
     $params = array('exportDestination' => 'download');
     $ret = $component->prepareExportDeliverable($testfile, $params);
     $this->assertTrue($ret);
     $params['compressOutput'] = true;
     $ret = $component->prepareExportDeliverable($testfile, $params);
     $this->assertTrue($ret);
     $this->assertFileExists($component->safePath('contacts.zip'));
     unlink($component->safePath('contacts.zip'));
 }
開發者ID:dsyman2,項目名稱:X2CRM,代碼行數:23,代碼來源:ImportExportBehaviorTest.php


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