Esempio n. 1
0
 /**
  * Insert data in database
  *
  * @return bool
  */
 protected function insert()
 {
     $sql = $this->builder->insert($this);
     $result = Db::query($sql);
     $this->id = Db::getLastInsertId();
     return $result;
 }
Esempio n. 2
0
 /**
  * @covers Veles\DataBase\Db::getLastInsertId
  */
 public function testGetLastInsertId()
 {
     $adapter = $this->getMockBuilder('\\Veles\\DataBase\\Adapters\\PdoAdapter')->setMethods(['getLastInsertId'])->getMock();
     $adapter->expects($this->once())->method('getLastInsertId')->willReturn($adapter);
     Db::setAdapter($adapter);
     Db::getLastInsertId();
 }