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