Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
c30eae62
Commit
c30eae62
authored
May 29, 2013
by
Gevik Babakhani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added initial unit testing files for the pgsql driver.
parent
647a1587
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
144 additions
and
150 deletions
+144
-150
Schema.php
framework/yii/db/pgsql/Schema.php
+37
-0
config.php
tests/unit/data/config.php
+6
-0
postgres.sql
tests/unit/data/postgres.sql
+69
-150
PostgreSQLActiveRecordTest.php
tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php
+14
-0
PostgreSQLConnectionTest.php
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
+18
-0
No files found.
framework/yii/db/pgsql/Schema.php
0 → 100644
View file @
c30eae62
<?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
tests/unit/data/config.php
View file @
c30eae62
...
@@ -20,5 +20,11 @@ return array(
...
@@ -20,5 +20,11 @@ return array(
'password'
=>
''
,
'password'
=>
''
,
'fixture'
=>
__DIR__
.
'/mssql.sql'
,
'fixture'
=>
__DIR__
.
'/mssql.sql'
,
),
),
'pgsql'
=>
array
(
'dsn'
=>
'pgsql:host=localhost;dbname=yiitest;port=5432'
,
'username'
=>
'postgres'
,
'password'
=>
'postgres'
,
'fixture'
=>
__DIR__
.
'/postgres.sql'
,
)
)
)
);
);
tests/unit/data/postgres.sql
View file @
c30eae62
This diff is collapsed.
Click to expand it.
tests/unit/framework/db/pgsql/PostgreSQLActiveRecordTest.php
0 → 100644
View file @
c30eae62
<?php
namespace
yiiunit\framework\db\pgsql
;
use
yiiunit\framework\db\ActiveRecordTest
;
class
PostgreSQLActiveRecordTest
extends
ActiveRecordTest
{
protected
function
setUp
()
{
$this
->
driverName
=
'pgsql'
;
parent
::
setUp
();
}
}
tests/unit/framework/db/pgsql/PostgreSQLConnectionTest.php
0 → 100644
View file @
c30eae62
<?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
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment