/** * @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); }
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)); }