From 51c3346b466cca5cd23a5dbf244447c632171383 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Mon, 12 May 2014 08:42:41 +1200 Subject: [PATCH] BUG Fix deprecated use of statics in test cases --- tests/core/ConfigTest.php | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/tests/core/ConfigTest.php b/tests/core/ConfigTest.php index 29dd5ef34..21ae3bf43 100644 --- a/tests/core/ConfigTest.php +++ b/tests/core/ConfigTest.php @@ -1,6 +1,6 @@ assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'foo')); - $this->assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'bar')); + $this->assertEquals(3, Config::inst()->get('ConfigTest_TestNest', 'foo')); + $this->assertEquals(5, Config::inst()->get('ConfigTest_TestNest', 'bar')); // Test nest copies data Config::nest(); - $this->assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'foo')); - $this->assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'bar')); + $this->assertEquals(3, Config::inst()->get('ConfigTest_TestNest', 'foo')); + $this->assertEquals(5, Config::inst()->get('ConfigTest_TestNest', 'bar')); // Test nested data can be updated - Config::inst()->update('ConfigTest_DefinesFooAndBar', 'foo', 4); - $this->assertEquals(4, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'foo')); - $this->assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'bar')); + Config::inst()->update('ConfigTest_TestNest', 'foo', 4); + $this->assertEquals(4, Config::inst()->get('ConfigTest_TestNest', 'foo')); + $this->assertEquals(5, Config::inst()->get('ConfigTest_TestNest', 'bar')); // Test unnest restores data Config::unnest(); - $this->assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'foo')); - $this->assertEquals(3, Config::inst()->get('ConfigTest_DefinesFooAndBar', 'bar')); + $this->assertEquals(3, Config::inst()->get('ConfigTest_TestNest', 'foo')); + $this->assertEquals(5, Config::inst()->get('ConfigTest_TestNest', 'bar')); } public function testUpdateStatic() { @@ -292,7 +299,7 @@ class ConfigTest extends SapphireTest { } } -class ConfigTest_Config_LRU extends Config_LRU { +class ConfigTest_Config_LRU extends Config_LRU implements TestOnly { public $cache; public $indexing;