Beispiel #1
0
 /**
  * test creating 1 dimensional array of query
  */
 public function testFetchArray()
 {
     $query = new Query("select at.action_type_id\n                            ,      at.short_name\n                            ,      at.name\n                            from   cm_action_types at\n                            where  at.action_type_id between 1 and 3\n                            order by 1", 'CM');
     // test named creation
     $array = $query->fetchArray('action_type_id', 'name');
     $expected = array(1 => 'Direct Mail', 2 => 'Telemarketing Inbound', 3 => 'Telemarketing Outbound');
     $this->assertEquals($expected, $array);
     // test unnamed creation (using first 2 columns)
     $array = $query->fetchArray();
     $expected = array(1 => 'DM', 2 => 'TM in', 3 => 'TM out');
     $this->assertEquals($expected, $array);
 }