/**
  * Method to test createDatabase().
  *
  * @return void
  *
  * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::createDatabase
  */
 public function testCreateDatabase()
 {
     $expected = "CREATE DATABASE {$this->qn('foo')}";
     $actual = PostgresqlQueryBuilder::createDatabase('foo');
     $this->assertEquals($this->format($expected), $this->format($actual));
     $expected = "CREATE DATABASE {$this->qn('foo')} ENCODING 'utf8'";
     $actual = PostgresqlQueryBuilder::createDatabase('foo', 'utf8');
     $this->assertEquals($this->format($expected), $this->format($actual));
     $expected = "CREATE DATABASE {$this->qn('foo')} ENCODING 'utf8' OWNER {$this->qn('bar')}";
     $actual = PostgresqlQueryBuilder::createDatabase('foo', 'utf8', 'bar');
     $this->assertEquals($this->format($expected), $this->format($actual));
 }
 /**
  * Method to test createDatabase().
  *
  * @return void
  *
  * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::createDatabase
  */
 public function testCreateDatabase()
 {
     $expected = "CREATE DATABASE {$this->qn}foo{$this->qn}";
     $actual = PostgresqlQueryBuilder::createDatabase('foo');
     $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
     $expected = "CREATE DATABASE IF NOT EXISTS {$this->qn}foo{$this->qn}";
     $actual = PostgresqlQueryBuilder::createDatabase('foo', true);
     $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
     $expected = "CREATE DATABASE IF NOT EXISTS {$this->qn}foo{$this->qn} CHARACTER SET='utf8' COLLATE='bar'";
     $actual = PostgresqlQueryBuilder::createDatabase('foo', true, 'utf8', 'bar');
     $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
 }
 /**
  * createDatabase
  *
  * @param bool   $ifNotExists
  * @param string $charset
  *
  * @return  static
  */
 public function create($ifNotExists = false, $charset = 'utf8')
 {
     $query = PostgresqlQueryBuilder::createDatabase($this->database, $charset);
     $this->db->setQuery($query)->execute();
     return $this;
 }