Commit c30eae62 by Gevik Babakhani

Added initial unit testing files for the pgsql driver.

parent 647a1587
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace yii\db\pgsql;
use yii\db\TableSchema;
use yii\db\ColumnSchema;
/**
* Schema is the class for retrieving metadata from a PostgreSQL database (version 9.x and above).
*
* @author Gevik Babakhani <gevikb@gmail.com>
* @since 2.0
*/
class Schema extends \yii\db\Schema
{
/**
* Loads the metadata for the specified table.
* @param string $name table name
* @return TableSchema|null driver dependent table metadata. Null if the table does not exist.
*/
public function loadTableSchema($name)
{
$table = new TableSchema();
$this->resolveTableNames($table, $name);
$this->findPrimaryKeys($table);
if ($this->findColumns($table)) {
$this->findForeignKeys($table);
return $table;
}
}
}
\ No newline at end of file
......@@ -20,5 +20,11 @@ return array(
'password' => '',
'fixture' => __DIR__ . '/mssql.sql',
),
'pgsql' => array(
'dsn' => 'pgsql:host=localhost;dbname=yiitest;port=5432',
'username' => 'postgres',
'password' => 'postgres',
'fixture' => __DIR__ . '/postgres.sql',
)
)
);
<?php
namespace yiiunit\framework\db\pgsql;
use yiiunit\framework\db\ActiveRecordTest;
class PostgreSQLActiveRecordTest extends ActiveRecordTest
{
protected function setUp()
{
$this->driverName = 'pgsql';
parent::setUp();
}
}
<?php
namespace yiiunit\framework\db\pgsql;
use yiiunit\framework\db\ConnectionTest;
class PostgreSQLConnectionTest extends ConnectionTest
{
public function setUp()
{
$this->driverName = 'pgsql';
parent::setUp();
}
public function testConnection() {
$connection = $this->getConnection(true);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment