Пример #1
0
 public function testReturnsDefaultValueWhenDoesNotContainRequestedValue()
 {
     $random = rand(100, 200);
     $array = new SugarArray(array());
     $this->assertEquals($array->get('unknown', $random), $random);
 }
Пример #2
0
 public function testget()
 {
     //execute the method and test if it returns expected values
     //test for a top level key
     $tempArray = new SugarArray(array('Key1' => array('Key2' => 'value2', 'Key3' => 'value3'), 'key4' => 'value4'));
     $expected = 'value4';
     $actual = $tempArray->get('key4');
     $this->assertSame($expected, $actual);
     //test for a child level key with dot notation
     $tempArray = new SugarArray(array('key1' => array('key2' => 'value2', 'key3' => 'value3'), 'key4' => 'value4'));
     $expected = 'value3';
     $actual = $tempArray->get('key1.key3');
     $this->assertSame($expected, $actual);
 }