Add partial test for config delete

This commit is contained in:
Timothy Warren 2015-10-15 10:23:00 -04:00
parent d231b39fdc
commit de444857dd
3 changed files with 7 additions and 6 deletions

View File

@ -39,7 +39,7 @@ class Config {
{ {
if (is_array($key)) if (is_array($key))
{ {
return $this->get_deep_key($key, FALSE); return $this->arr($this->map)->get_deep_key($key);
} }
if (array_key_exists($key, $this->map)) if (array_key_exists($key, $this->map))
@ -104,7 +104,7 @@ class Config {
$pos =& $this->map[$key]; $pos =& $this->map[$key];
} }
unset($pos); $pos = NULL;
} }
/** /**

View File

@ -18,6 +18,8 @@ class ConfigTest extends AnimeClient_TestCase {
$this->assertEquals('bar', $this->config->get('foo')); $this->assertEquals('bar', $this->config->get('foo'));
$this->assertEquals('baz', $this->config->get('bar')); $this->assertEquals('baz', $this->config->get('bar'));
$this->assertNull($this->config->get('baz')); $this->assertNull($this->config->get('baz'));
$this->assertNull($this->config->get(['apple','sauce']));
} }
public function testConfigSet() public function testConfigSet()
@ -49,7 +51,7 @@ class ConfigTest extends AnimeClient_TestCase {
] ]
] ]
], ],
'mid level delete' => [ /*'mid level delete' => [
'key' => ['apple', 'sauce'], 'key' => ['apple', 'sauce'],
'assertKeys' => [ 'assertKeys' => [
[ [
@ -78,7 +80,7 @@ class ConfigTest extends AnimeClient_TestCase {
'expected' => NULL 'expected' => NULL
] ]
] ]
] ]*/
]; ];
} }
@ -87,7 +89,6 @@ class ConfigTest extends AnimeClient_TestCase {
*/ */
public function testConfigDelete($key, $assertKeys) public function testConfigDelete($key, $assertKeys)
{ {
$this->markTestIncomplete();
$this->config->set(['apple', 'sauce', 'is'], 'great'); $this->config->set(['apple', 'sauce', 'is'], 'great');
$this->config->delete($key); $this->config->delete($key);

View File

@ -58,7 +58,7 @@ class BaseApiModelTest extends AnimeClient_TestCase {
]; ];
return [ return [
'invalid' => [ 'invalid method' => [
'method' => 'foo', 'method' => 'foo',
'uri' => '', 'uri' => '',
'options' => [], 'options' => [],