/** * MagicDb::toArray should either return the MagicDb::db property, or the parsed array data if a magic.db dump is passed in as the first argument * * @access public */ function testToArray() { $this->Db->db = array(); $r = $this->Db->toArray(); $this->assertTrue($r === array()); $this->Db->db = array('foo' => 'bar'); $r = $this->Db->toArray(); $this->assertTrue($r === array('foo' => 'bar')); $r = $this->Db->toArray(array('yeah')); $this->assertTrue($r === array('yeah')); $r = $this->Db->toArray('foo'); $this->assertTrue($r === array()); $r = $this->Db->toArray(MagicDbTestData::get('magic.snippet.db')); $this->assertTrue($r === MagicDbTestData::get('magic.snippet.db.result')); }
/** * MagicDb::toArray should either return the MagicDb::db property, or the parsed array data if a magic.db dump is passed in as the first argument * * @access public */ function testToArray() { $this->Db->db = array(); $r = $this->Db->toArray(); $this->assertTrue($r === array()); $this->Db->db = array('foo' => 'bar'); $r = $this->Db->toArray(); $this->assertTrue($r === array('foo' => 'bar')); $r = $this->Db->toArray(array('yeah')); $this->assertTrue($r === array('yeah')); $r = $this->Db->toArray("# FILE_ID DB\r\n# Date:2009-10-10\r\n# Source:xxx.php"); $this->assertTrue($r === array()); $r = $this->Db->toArray('foo'); $this->assertTrue($r === array()); $r = $this->Db->toArray(MagicDbTestData::get('magic.snippet.db')); $this->assertTrue($r === MagicDbTestData::get('magic.snippet.db.result')); }