/**
  * @covers Nethgui\Adapter\TableAdapter::save
  * @todo   Implement testSave().
  */
 public function testSave1()
 {
     $f = $e = new \ArrayObject(array('1K' => new \ArrayObject(array('type' => 'T1', '1P' => '1V', '1Q' => '1W')), '2K' => new \ArrayObject(array('type' => 'T2', '2P' => '2V', '2Q' => '2W')), '3K' => new \ArrayObject(array('type' => 'T3', '3P' => '3V', '3Q' => '3W'))));
     $this->mockDb->set(DB::setKey('4K', 'T4', array('4P' => '4V', '4Q' => '4W')), $f);
     $this->mockDb->setFinal(TRUE);
     $this->object->offsetSet('4K', array('type' => 'T4', '4P' => '4V', '4Q' => '4W'));
     $this->assertTrue($this->object->isModified());
     $this->assertEquals(1, $this->object->save());
 }
 /**
  * @return \Nethgui\Test\Tool\DB
  */
 protected function getDB()
 {
     $db = new \Nethgui\Test\Tool\DB();
     $type = 'T';
     $initialTable = array();
     foreach (array(1, 2, 3) as $i) {
         $initialTable[$i . 'K'] = array('type' => $type, $i . 'P' => $i . 'V', $i . 'Q' => $i . 'W');
     }
     return $db->set(DB::getAll('T'), $initialTable);
 }
 /**
  * @return \Nethgui\Test\Tool\DB
  */
 protected function getDB()
 {
     $db = new \Nethgui\Test\Tool\DB();
     $type = 'T';
     $initialTable = array();
     foreach (array(1, 2) as $i) {
         $initialTable['k' . $i] = array();
         foreach (array('A', 'B', 'C') as $j) {
             $initialTable['k' . $i]['type'] = $type;
             $initialTable['k' . $i][$j] = implode(',', array('v', $i, $j));
         }
     }
     return $db->set(DB::getAll('T'), $initialTable);
 }
 public function testSave1()
 {
     $e = new \ArrayObject(array('2K' => new \ArrayObject(array('2P' => '2V', '2Q' => '2W')), '3K' => new \ArrayObject(array('3P' => '3V', '3Q' => '3W'))));
     $this->object = new \Nethgui\Adapter\TableAdapter(MockFactory::getMockDatabase($this, $this->getDB()->set(DB::deleteKey("1K"), $e)), 'T', FALSE);
     $this->assertFalse($this->object->isModified());
     unset($this->object['1K']);
     $this->assertTrue($this->object->isModified());
     $c = $this->object->save();
     $this->assertEquals(1, $c);
     $this->assertFalse($this->object->isModified());
     $this->assertFalse(isset($this->object['1K']));
 }