Skip to content

Commit

Permalink
Removed parentheses and added unit tests to verify the behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
rianorie committed Nov 12, 2014
1 parent af452dc commit 2c2bb31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion phalcon/config.zep
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Config implements \ArrayAccess, \Countable
for key, value in arrayConfig {

let key = strval(key);
if (typeof value === "array") {
if typeof value === "array" {
let this->{key} = new self(value);
} else {
let this->{key} = value;
Expand Down
12 changes: 12 additions & 0 deletions unit-tests/ConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,4 +263,16 @@ public function testYamlConfigCallback()
));
$this->assertTrue($this->_compareConfig($this->_config, $config));
}

public function testNumericConfig()
{
$config = new \Phalcon\Config(["abc"]);
$this->assertEquals($config->{0}, "abc");
}

public function testChildArrayToConfigObject()
{
$config = new \Phalcon\Config(['childsettings' => ['A', 'B', 'C']]);
$this->assertInstanceOf('Phalcon\Config', $config->childsettings);
}
}

0 comments on commit 2c2bb31

Please sign in to comment.