From c90927a3064ca70fc560b8f12e6bf2806c0241cb Mon Sep 17 00:00:00 2001 From: nathangray Date: Wed, 5 Sep 2018 12:04:09 -0600 Subject: [PATCH] Trying to get tests to pass - Intermediate variable throughout --- admin/tests/PreferencesCommandTest.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/admin/tests/PreferencesCommandTest.php b/admin/tests/PreferencesCommandTest.php index 6abec59e97..61d8524a3d 100644 --- a/admin/tests/PreferencesCommandTest.php +++ b/admin/tests/PreferencesCommandTest.php @@ -128,9 +128,11 @@ class PreferencesCommandTest extends CommandBase $this->assertEquals($set[$this->preference_name], $post[static::APP][$this->preference_name]); // At type level - $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + // Get type as an array since direct sub-access doesn't work in 5.6 + $post_app = $post_pref->$type; + $this->assertArrayHasKey($this->preference_name, $post_app[static::APP], "$type preferences does not have {$this->preference_name}"); - $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); + $this->assertEquals($set[$this->preference_name], $post_app[static::APP][$this->preference_name]); $this->assertGreaterThan($log_count, $this->get_log_count(), "Command ($command) did not log"); } @@ -178,9 +180,11 @@ class PreferencesCommandTest extends CommandBase ); // At type level - $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + // Get type as an array since direct sub-access doesn't work in 5.6 + $post_app = $post_pref->$type; + $this->assertArrayHasKey($this->preference_name, $post_app[static::APP], "$type preferences does not have {$this->preference_name}"); - $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); + $this->assertEquals($set[$this->preference_name], $post_app[static::APP][$this->preference_name]); $this->assertGreaterThan($log_count, $this->get_log_count(), "Command ($command) did not log"); } @@ -224,9 +228,11 @@ class PreferencesCommandTest extends CommandBase $post = $post_pref->read_repository(false); // At type level - should always be what we set - $this->assertArrayHasKey($this->preference_name, $post_pref->$type[static::APP], + // Get type as an array since direct sub-access doesn't work in 5.6 + $post_app = $post_pref->$type; + $this->assertArrayHasKey($this->preference_name, $post_app[static::APP], "$type preferences does not have {$this->preference_name}"); - $this->assertEquals($set[$this->preference_name], $post_pref->$type[static::APP][$this->preference_name]); + $this->assertEquals($set[$this->preference_name], $post_app[static::APP][$this->preference_name]); // At user level - depends on type priority $this->assertArrayHasKey($this->preference_name, $post[static::APP]); @@ -272,7 +278,9 @@ class PreferencesCommandTest extends CommandBase $this->assertEquals($override ? $set[$this->preference_name] : $old[$this->preference_name], $post[static::APP][$this->preference_name]); // At type level - $this->assertNull($post_pref->$check[static::APP][$this->preference_name]); + // Get type as an array since direct sub-access doesn't work in 5.6 + $post_app = $post_pref->$check; + $this->assertNull($post_app[static::APP][$this->preference_name]); $this->assertGreaterThan($log_count, $this->get_log_count(), "Command ($command) did not log"); }