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


PHP Apple::set方法代码示例

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


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

示例1: testBehaviorMethodDispatchingWithData

 /**
  * testBehaviorMethodDispatchingWithData method
  *
  * @return void
  */
 public function testBehaviorMethodDispatchingWithData()
 {
     $Apple = new Apple();
     $Apple->Behaviors->attach('Test');
     $Apple->set('field', 'value');
     $this->assertTrue($Apple->testData());
     $this->assertTrue($Apple->data['Apple']['field_2']);
     $this->assertTrue($Apple->testData('one', 'two', 'three', 'four', 'five', 'six'));
 }
开发者ID:magooemp,项目名称:eramba,代码行数:14,代码来源:BehaviorCollectionTest.php

示例2: testDeconstructFieldsDateTime

 /**
  * testDeconstructFields with datetime, timestamp, and date fields
  *
  * @return void
  */
 public function testDeconstructFieldsDateTime()
 {
     $this->skipIf($this->db instanceof Sqlserver, 'This test is not compatible with SQL Server.');
     $this->loadFixtures('Apple');
     $TestModel = new Apple();
     //test null/empty values first
     $data['Apple']['created']['year'] = '';
     $data['Apple']['created']['month'] = '';
     $data['Apple']['created']['day'] = '';
     $data['Apple']['created']['hour'] = '';
     $data['Apple']['created']['min'] = '';
     $data['Apple']['created']['sec'] = '';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => ''));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['date']['year'] = '';
     $data['Apple']['date']['month'] = '';
     $data['Apple']['date']['day'] = '';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('date' => ''));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['year'] = '2007';
     $data['Apple']['created']['month'] = '08';
     $data['Apple']['created']['day'] = '20';
     $data['Apple']['created']['hour'] = '';
     $data['Apple']['created']['min'] = '';
     $data['Apple']['created']['sec'] = '';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => '2007-08-20 00:00:00'));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['year'] = '2007';
     $data['Apple']['created']['month'] = '08';
     $data['Apple']['created']['day'] = '20';
     $data['Apple']['created']['hour'] = '10';
     $data['Apple']['created']['min'] = '12';
     $data['Apple']['created']['sec'] = '';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => '2007-08-20 10:12:00'));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['year'] = '2007';
     $data['Apple']['created']['month'] = '';
     $data['Apple']['created']['day'] = '12';
     $data['Apple']['created']['hour'] = '20';
     $data['Apple']['created']['min'] = '';
     $data['Apple']['created']['sec'] = '';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => ''));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['hour'] = '20';
     $data['Apple']['created']['min'] = '33';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => ''));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['hour'] = '20';
     $data['Apple']['created']['min'] = '33';
     $data['Apple']['created']['sec'] = '33';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => ''));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['hour'] = '13';
     $data['Apple']['created']['min'] = '00';
     $data['Apple']['date']['year'] = '2006';
     $data['Apple']['date']['month'] = '12';
     $data['Apple']['date']['day'] = '25';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => '', 'date' => '2006-12-25'));
     $this->assertEquals($expected, $TestModel->data);
     $data = array();
     $data['Apple']['created']['year'] = '2007';
     $data['Apple']['created']['month'] = '08';
     $data['Apple']['created']['day'] = '20';
     $data['Apple']['created']['hour'] = '10';
     $data['Apple']['created']['min'] = '12';
     $data['Apple']['created']['sec'] = '09';
     $data['Apple']['date']['year'] = '2006';
     $data['Apple']['date']['month'] = '12';
     $data['Apple']['date']['day'] = '25';
     $TestModel->data = null;
     $TestModel->set($data);
     $expected = array('Apple' => array('created' => '2007-08-20 10:12:09', 'date' => '2006-12-25'));
//.........这里部分代码省略.........
开发者ID:agashish,项目名称:test_new,代码行数:101,代码来源:ModelIntegrationTest.php

示例3: testBehaviorMethodDispatchingWithData

 /**
  * testBehaviorMethodDispatchingWithData method
  *
  * @access public
  * @return void
  */
 function testBehaviorMethodDispatchingWithData()
 {
     $Apple = new Apple();
     $Apple->Behaviors->attach('Test');
     $Apple->set('field', 'value');
     $this->assertTrue($Apple->testData());
     $this->assertTrue($Apple->data['Apple']['field_2']);
 }
开发者ID:masayukiando,项目名称:googlemap-search_ActionScript3.0,代码行数:14,代码来源:behavior.test.php


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