public function testLoadArray() { $this->assertAttributeNotEmpty('array_ob', $this->ap); $this->ap->loadArray(array()); $this->assertAttributeEmpty('array_ob', $this->ap); $this->ap->loadArray(array('some', 'value', 'third')); $this->assertEquals(3, count($this->ap->toArray())); }
echo '$a->database->name: ' . $a->database->name . "<br/>" . "\n"; echo 'var_dump($a->app->log): <br/>'; var_dump($a->app->log); /** * Check if leaf/node exists */ echo '<h3>Check if leaf/node exists:</h3>'; echo '$a->database->exist(\'host\'): ' . "<br/>" . "\n"; var_dump($a->database->exist('host')); /** * Convert nodes to arrays, has more 'leaves' */ echo '<h3>Convert using ->toArray() :</h3>'; $array_node = $a->database->toArray(); var_dump($array_node); $deep = $a->app->deep->toArray(); var_dump($deep); /** * Get internal PHP's ArrayObject element */ echo '<h3>Get internal PHP\'s ArrayObject element</h3>'; echo 'count: ' . $a->getArrayObject()->count(); //count of values /** * Reload a new array into */ echo '<h3>loadArray() - Load a new array into object</h3>'; echo '$new = array(1 => \'apple\', 2 => \'orange\', 3 => \'olive\', 4 => \'grapes\');<br>'; $new = array(1 => 'apple', 2 => 'orange', 3 => 'olive', 4 => 'grapes'); echo '$a->loadArray($new)->{1}; - outputs <b>' . $a->loadArray($new)->{1} . '</b>';