Ejemplo n.º 1
0
 /**
  *  For this test you need to have $items and symmetrize() set to public.
  */
 public function testColumnizeSymmetrize()
 {
     // Here we test if the hobby field for Joe will get pre-filled.
     $columnizer = $columnizer = new \mechanicious\Columnizer\Columnizer($this->mockData);
     $columnizer->symmetrize();
     $this->assertEquals($columnizer->items, array(array('id' => 1, 'name' => 'Joe', 'age' => 25, 'hobby' => null), array('id' => 2, 'name' => 'Tony', 'age' => 27, 'hobby' => 'sport')));
 }
Ejemplo n.º 2
0
 public function testArrayAccessColumnizerColumnizeWithData()
 {
     $columnizer = new \mechanicious\Columnizer\Columnizer($this->mockData);
     // ColumnBag
     //      |--- Column (id)
     //          |--- 1, 2
     //    |--- Column (name)
     //    |--- Column (age)
     //    |--- Column (hobby)
     $this->assertEquals(get_class($columnizer->columnizeRowArray()), 'mechanicious\\Columnizer\\ColumnBag');
     $this->assertEquals(get_class($columnizer->columnizeRowArray()->get('name')), 'mechanicious\\Columnizer\\Column');
     // ArrayAccess in action
     $this->assertEquals($columnizer->columnizeRowArray()['name'][1], 'Tony');
 }