Exemplo n.º 1
0
 /**
  * @param string $tableName
  * @throws \Exception
  * @return bool
  */
 public function existsTable($tableName)
 {
     if (!preg_match('/^[a-z0-9_]+$/i', $tableName)) {
         throw new \Exception("invalid table name '{$tableName}'");
     }
     return $this->dbDriver->existsTable($tableName);
 }
Exemplo n.º 2
0
 function testInsertTableRowReturning()
 {
     $this->driver->shouldReceive('insertPreparedAndReturn')->withArgs(array(anything(), '/insert into europe \\(animal\\) values \\(\\$1\\)/i', array('mouse'), 'id'))->andReturnUsing(function ($stmt, $sql, $params, $colName) {
         return $colName == 'id' ? 23 : -1;
     });
     $returnId = $this->dbManager->insertInto('europe', 'animal', array('mouse'), $log = 'logging', 'id');
     assertThat($returnId, equalTo(23));
 }