Skip to content

Commit

Permalink
Updated unit test for Phalcon\Config
Browse files Browse the repository at this point in the history
  • Loading branch information
sjinks committed Jun 29, 2013
1 parent 4434add commit 50cc77b
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions unit-tests/ConfigTest.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,42 @@ public function testConfigMerge()

}


public function testIssue731()
{
// Code path AAA, B, AE, B
$a = new Phalcon\Config(array('aaa' => array('b' => 2, 'c' => 3)));
$b = new Phalcon\Config(array('aaa' => array('a' => 10, 'c' => 30, 'd' => 40)));
$c = array('aaa' => array('b' => 2, 'c' => 30, 'a' => 10, 'd' => 40));
$a->merge($b);
$this->assertEquals($a->toArray(), $c);

// Code path AAB
$a = new Phalcon\Config(array('aab' => (object)array('n' => 'm')));
$b = new Phalcon\Config(array('aab' => array('x' => 'y')));
$c = array('aab' => array('x' => 'y'));
$a->merge($b);
$this->assertEquals($a->toArray(), $c);

//Code path AB
$a = new Phalcon\Config(array('ab' => array('b' => 1, 'c' => 2)));
$b = new Phalcon\Config(array('ab' => array(0 => -10, 'c' => 20, 'd' => 30)));
$c = array('ab' => array(0 => -10, 'c' => 2, 'd' => 30, 'b' => 1));
$b->merge($a);
$this->assertEquals($b->toArray(), $c);

// Code path AC
$a = new Phalcon\Config(array('ac' => array('b' => 1, 'c' => 2)));
$b = new Phalcon\Config(array('ac' => array(0 => -10, 'c' => 20, 'd' => 30)));
$c = array('ac' => array(0 => -10, 'c' => 20, 'd' => 30, 'b' => 1));
$a->merge($b);
$this->assertEquals($a->toArray(), $c);

// Code path AD
$a = new Phalcon\Config(array('ad' => array(0 => 1, 1 => 2, 2 => 3)));
$b = new Phalcon\Config(array('ad' => array(1 => 20, 3 => 40)));
$c = array('ad' => array(0 => 1, 1 => 20, 2 => 3, 3 => 40));
$a->merge($b);
$this->assertEquals($a->toArray(), $c);
}
}

0 comments on commit 50cc77b

Please sign in to comment.