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


PHP Deprecation::restore_settings方法代码示例

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


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

示例1: testGetArray

 public function testGetArray()
 {
     $originalDeprecation = Deprecation::dump_settings();
     Deprecation::notification_version('2.4');
     $array = array('Foo' => 'Foo', 'Bar' => 'Bar', 'Baz' => 'Baz');
     $arrayData = new ArrayData($array);
     $this->assertEquals($arrayData->toMap(), $array);
     Deprecation::restore_settings($originalDeprecation);
 }
开发者ID:normann,项目名称:sapphire,代码行数:9,代码来源:ArrayDataTest.php

示例2: testGroupMap

 /**
  * Test the Group::map() function
  */
 public function testGroupMap()
 {
     // 2.4 only
     $originalDeprecation = Deprecation::dump_settings();
     Deprecation::notification_version('2.4');
     /* Group::map() returns an SQLMap object implementing iterator.  You can use foreach to get ID-Title pairs. */
     // We will iterate over the map and build mapOuput to more easily call assertions on the result.
     $map = Group::map();
     $mapOutput = $map->toArray();
     $group1 = $this->objFromFixture('Group', 'group1');
     $group2 = $this->objFromFixture('Group', 'group2');
     /* We have added 2 groups to our fixture.  They should both appear in $mapOutput. */
     $this->assertEquals($mapOutput[$group1->ID], $group1->Title);
     $this->assertEquals($mapOutput[$group2->ID], $group2->Title);
     Deprecation::restore_settings($originalDeprecation);
 }
开发者ID:normann,项目名称:sapphire,代码行数:19,代码来源:GroupTest.php

示例3: tearDown

 public function tearDown()
 {
     Deprecation::restore_settings($this->depSettings);
     parent::tearDown();
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:5,代码来源:ControllerTest.php

示例4: tearDown

 public function tearDown()
 {
     parent::tearDown();
     Deprecation::restore_settings($this->originalDeprecation);
 }
开发者ID:jakedaleweb,项目名称:AtomCodeChallenge,代码行数:5,代码来源:AggregateTest.php

示例5: testGet

 /**
  * Test methods that get DataObjects
  *   - DataObject::get()
  *       - All records of a DataObject
  *       - Filtering
  *       - Sorting
  *       - Joins
  *       - Limit
  *       - Container class
  *   - DataObject::get_by_id()
  *   - DataObject::get_one()
  *        - With and without caching
  *        - With and without ordering
  */
 public function testGet()
 {
     // Test getting all records of a DataObject
     $comments = DataObject::get('DataObjectTest_TeamComment');
     $this->assertEquals(3, $comments->Count());
     // Test WHERE clause
     $comments = DataObject::get('DataObjectTest_TeamComment', "\"Name\"='Bob'");
     $this->assertEquals(1, $comments->Count());
     foreach ($comments as $comment) {
         $this->assertEquals('Bob', $comment->Name);
     }
     // Test sorting
     $comments = DataObject::get('DataObjectTest_TeamComment', '', "\"Name\" ASC");
     $this->assertEquals(3, $comments->Count());
     $this->assertEquals('Bob', $comments->First()->Name);
     $comments = DataObject::get('DataObjectTest_TeamComment', '', "\"Name\" DESC");
     $this->assertEquals(3, $comments->Count());
     $this->assertEquals('Phil', $comments->First()->Name);
     // Test join - 2.4 only
     $originalDeprecation = Deprecation::dump_settings();
     Deprecation::notification_version('2.4');
     $comments = DataObject::get('DataObjectTest_TeamComment', "\"DataObjectTest_Team\".\"Title\" = 'Team 1'", "\"Name\" ASC", "INNER JOIN \"DataObjectTest_Team\"" . " ON \"DataObjectTest_TeamComment\".\"TeamID\" = \"DataObjectTest_Team\".\"ID\"");
     $this->assertEquals(2, $comments->Count());
     $this->assertEquals('Bob', $comments->First()->Name);
     $this->assertEquals('Joe', $comments->Last()->Name);
     Deprecation::restore_settings($originalDeprecation);
     // Test limit
     $comments = DataObject::get('DataObjectTest_TeamComment', '', "\"Name\" ASC", '', '1,2');
     $this->assertEquals(2, $comments->Count());
     $this->assertEquals('Joe', $comments->First()->Name);
     $this->assertEquals('Phil', $comments->Last()->Name);
     // Test get_by_id()
     $captain1ID = $this->idFromFixture('DataObjectTest_Player', 'captain1');
     $captain1 = DataObject::get_by_id('DataObjectTest_Player', $captain1ID);
     $this->assertEquals('Captain', $captain1->FirstName);
     // Test get_one() without caching
     $comment1 = DataObject::get_one('DataObjectTest_TeamComment', "\"Name\" = 'Joe'", false);
     $comment1->Comment = "Something Else";
     $comment2 = DataObject::get_one('DataObjectTest_TeamComment', "\"Name\" = 'Joe'", false);
     $this->assertNotEquals($comment1->Comment, $comment2->Comment);
     // Test get_one() with caching
     $comment1 = DataObject::get_one('DataObjectTest_TeamComment', "\"Name\" = 'Bob'", true);
     $comment1->Comment = "Something Else";
     $comment2 = DataObject::get_one('DataObjectTest_TeamComment', "\"Name\" = 'Bob'", true);
     $this->assertEquals((string) $comment1->Comment, (string) $comment2->Comment);
     // Test get_one() with order by without caching
     $comment = DataObject::get_one('DataObjectTest_TeamComment', '', false, "\"Name\" ASC");
     $this->assertEquals('Bob', $comment->Name);
     $comment = DataObject::get_one('DataObjectTest_TeamComment', '', false, "\"Name\" DESC");
     $this->assertEquals('Phil', $comment->Name);
     // Test get_one() with order by with caching
     $comment = DataObject::get_one('DataObjectTest_TeamComment', '', true, '"Name" ASC');
     $this->assertEquals('Bob', $comment->Name);
     $comment = DataObject::get_one('DataObjectTest_TeamComment', '', true, '"Name" DESC');
     $this->assertEquals('Phil', $comment->Name);
 }
开发者ID:normann,项目名称:sapphire,代码行数:70,代码来源:DataObjectTest.php

示例6: testURLParams

 public function testURLParams()
 {
     // 2.4 only
     $originalDeprecation = Deprecation::dump_settings();
     Deprecation::notification_version('2.4');
     Director::test('DirectorTestRule/myaction/myid/myotherid');
     // TODO Works on the assumption that urlParam() is not unset after a test run, which is dodgy
     $this->assertEquals(Director::urlParams(), array('Controller' => 'DirectorTestRequest_Controller', 'Action' => 'myaction', 'ID' => 'myid', 'OtherID' => 'myotherid'));
     Deprecation::restore_settings($originalDeprecation);
 }
开发者ID:normann,项目名称:sapphire,代码行数:10,代码来源:DirectorTest.php

示例7: testLRUCleaning

 public function testLRUCleaning()
 {
     $depSettings = Deprecation::dump_settings();
     Deprecation::restore_settings(array('level' => false, 'version' => false, 'moduleVersions' => false));
     $cache = new ConfigTest_Config_LRU();
     for ($i = 0; $i < Config_LRU::SIZE; $i++) {
         $cache->set($i, $i);
     }
     $this->assertEquals(Config_LRU::SIZE, count($cache->indexing));
     $cache->clean();
     $this->assertEquals(0, count($cache->indexing), 'Clean clears all items');
     $this->assertFalse($cache->get(1), 'Clean clears all items');
     $cache->set(1, 1, array('Foo'));
     $this->assertEquals(1, count($cache->indexing));
     $cache->clean('Foo');
     $this->assertEquals(0, count($cache->indexing), 'Clean items with matching tag');
     $this->assertFalse($cache->get(1), 'Clean items with matching tag');
     $cache->set(1, 1, array('Foo', 'Bar'));
     $this->assertEquals(1, count($cache->indexing));
     $cache->clean('Bar');
     $this->assertEquals(0, count($cache->indexing), 'Clean items with any single matching tag');
     $this->assertFalse($cache->get(1), 'Clean items with any single matching tag');
     Deprecation::restore_settings($depSettings);
 }
开发者ID:ntd,项目名称:sapphire,代码行数:24,代码来源:ConfigTest.php

示例8: testRewriteTabPathFindOrMakeTab

 public function testRewriteTabPathFindOrMakeTab()
 {
     $originalDeprecation = Deprecation::dump_settings();
     Deprecation::notification_version('2.4');
     $fields = new FieldList(new Tabset("Root", $tab1Level1 = new Tab("Tab1Level1Renamed", $tab1Level2 = new Tab("Tab1Level2"), $tab2Level2 = new Tab("Tab2Level2")), $tab2Level1 = new Tab("Tab2Level1")));
     $fields->setTabPathRewrites(array('/Root\\.Tab1Level1\\.([^.]+)$/' => 'Root.Tab1Level1Renamed.\\1', '/Root\\.Tab1Level1$/' => 'Root.Tab1Level1Renamed'));
     $this->assertEquals($tab1Level1, $fields->findOrMakeTab('Root.Tab1Level1'), 'findOrMakeTab() with toplevel tab under old name');
     $this->assertEquals($tab1Level1, $fields->findOrMakeTab('Root.Tab1Level1Renamed'), 'findOrMakeTab() with toplevel tab under new name');
     $this->assertEquals($tab1Level2, $fields->findOrMakeTab('Root.Tab1Level1.Tab1Level2'), 'findOrMakeTab() with nested tab under old parent tab name');
     $this->assertEquals($tab1Level2, $fields->findOrMakeTab('Root.Tab1Level1Renamed.Tab1Level2'), 'findOrMakeTab() with nested tab under new parent tab name');
     Deprecation::restore_settings($originalDeprecation);
 }
开发者ID:normann,项目名称:sapphire,代码行数:12,代码来源:FieldListTest.php

示例9: tearDown

	function tearDown() {
		Deprecation::restore_settings(self::$originalVersionInfo);
	}
开发者ID:redema,项目名称:sapphire,代码行数:3,代码来源:DeprecationTest.php


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