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
d1a3d400
Commit
d1a3d400
authored
May 26, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added test case to acually create cols with virtual type
verify issue #3473
parent
a55d9ba8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
19 deletions
+35
-19
QueryBuilderTest.php
tests/unit/framework/db/QueryBuilderTest.php
+15
-0
PostgreSQLQueryBuilderTest.php
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
+16
-15
SqliteQueryBuilderTest.php
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
+4
-4
No files found.
tests/unit/framework/db/QueryBuilderTest.php
View file @
d1a3d400
...
@@ -114,6 +114,21 @@ class QueryBuilderTest extends DatabaseTestCase
...
@@ -114,6 +114,21 @@ class QueryBuilderTest extends DatabaseTestCase
}
}
}
}
public
function
testCreateTableColumnTypes
()
{
$qb
=
$this
->
getQueryBuilder
();
$columns
=
[];
$i
=
0
;
foreach
(
$this
->
columnTypes
()
as
$item
)
{
list
(
$column
,
$expected
)
=
$item
;
if
(
strncmp
(
$column
,
'pk'
,
2
)
!==
0
)
{
$columns
[
'col'
.
++
$i
]
=
str_replace
(
'CHECK (value'
,
'CHECK (col'
.
$i
,
$column
);
}
}
$this
->
getConnection
(
false
)
->
createCommand
(
$qb
->
createTable
(
'column_type_table'
,
$columns
))
->
execute
();
$this
->
getConnection
(
false
)
->
createCommand
(
$qb
->
dropTable
(
'column_type_table'
))
->
execute
();
}
public
function
conditionProvider
()
public
function
conditionProvider
()
{
{
$conditions
=
[
$conditions
=
[
...
...
tests/unit/framework/db/pgsql/PostgreSQLQueryBuilderTest.php
View file @
d1a3d400
...
@@ -22,13 +22,13 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
...
@@ -22,13 +22,13 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
[
Schema
::
TYPE_PK
.
'(8) CHECK (value > 5)'
,
'serial NOT NULL PRIMARY KEY CHECK (value > 5)'
],
[
Schema
::
TYPE_PK
.
'(8) CHECK (value > 5)'
,
'serial NOT NULL PRIMARY KEY CHECK (value > 5)'
],
[
Schema
::
TYPE_STRING
,
'varchar(255)'
],
[
Schema
::
TYPE_STRING
,
'varchar(255)'
],
[
Schema
::
TYPE_STRING
.
'(32)'
,
'varchar(32)'
],
[
Schema
::
TYPE_STRING
.
'(32)'
,
'varchar(32)'
],
[
Schema
::
TYPE_STRING
.
' CHECK (value LIKE
"test%")'
,
'varchar(255) CHECK (value LIKE "test%"
)'
],
[
Schema
::
TYPE_STRING
.
' CHECK (value LIKE
\'test%\')'
,
'varchar(255) CHECK (value LIKE \'test%\'
)'
],
[
Schema
::
TYPE_STRING
.
'(32) CHECK (value LIKE
"test%")'
,
'varchar(32) CHECK (value LIKE "test%"
)'
],
[
Schema
::
TYPE_STRING
.
'(32) CHECK (value LIKE
\'test%\')'
,
'varchar(32) CHECK (value LIKE \'test%\'
)'
],
[
Schema
::
TYPE_STRING
.
' NOT NULL'
,
'varchar(255) NOT NULL'
],
[
Schema
::
TYPE_STRING
.
' NOT NULL'
,
'varchar(255) NOT NULL'
],
[
Schema
::
TYPE_TEXT
,
'text'
],
[
Schema
::
TYPE_TEXT
,
'text'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'text'
],
[
Schema
::
TYPE_TEXT
.
'(255)'
,
'text'
],
[
Schema
::
TYPE_TEXT
.
' CHECK (value LIKE
"test%")'
,
'text CHECK (value LIKE "test%"
)'
],
[
Schema
::
TYPE_TEXT
.
' CHECK (value LIKE
\'test%\')'
,
'text CHECK (value LIKE \'test%\'
)'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE
"test%")'
,
'text CHECK (value LIKE "test%"
)'
],
[
Schema
::
TYPE_TEXT
.
'(255) CHECK (value LIKE
\'test%\')'
,
'text CHECK (value LIKE \'test%\'
)'
],
[
Schema
::
TYPE_TEXT
.
' NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
' NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_TEXT
.
'(255) NOT NULL'
,
'text NOT NULL'
],
[
Schema
::
TYPE_SMALLINT
,
'smallint'
],
[
Schema
::
TYPE_SMALLINT
,
'smallint'
],
...
@@ -52,21 +52,22 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
...
@@ -52,21 +52,22 @@ class PostgreSQLQueryBuilderTest extends QueryBuilderTest
[
Schema
::
TYPE_DECIMAL
.
' CHECK (value > 5.6)'
,
'numeric(10,0) CHECK (value > 5.6)'
],
[
Schema
::
TYPE_DECIMAL
.
' CHECK (value > 5.6)'
,
'numeric(10,0) CHECK (value > 5.6)'
],
[
Schema
::
TYPE_DECIMAL
.
'(12,4) CHECK (value > 5.6)'
,
'numeric(12,4) CHECK (value > 5.6)'
],
[
Schema
::
TYPE_DECIMAL
.
'(12,4) CHECK (value > 5.6)'
,
'numeric(12,4) CHECK (value > 5.6)'
],
[
Schema
::
TYPE_DECIMAL
.
' NOT NULL'
,
'numeric(10,0) NOT NULL'
],
[
Schema
::
TYPE_DECIMAL
.
' NOT NULL'
,
'numeric(10,0) NOT NULL'
],
[
Schema
::
TYPE_DATETIME
,
'timestamp'
],
[
Schema
::
TYPE_DATETIME
,
'timestamp(0)'
],
[
Schema
::
TYPE_DATETIME
.
" CHECK(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"timestamp CHECK(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATETIME
.
" CHECK (value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"timestamp(0) CHECK (value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATETIME
.
' NOT NULL'
,
'timestamp NOT NULL'
],
[
Schema
::
TYPE_DATETIME
.
' NOT NULL'
,
'timestamp(0) NOT NULL'
],
[
Schema
::
TYPE_TIMESTAMP
,
'timestamp'
],
[
Schema
::
TYPE_TIMESTAMP
,
'timestamp(0)'
],
[
Schema
::
TYPE_TIMESTAMP
.
" CHECK(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"timestamp CHECK(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_TIMESTAMP
.
" CHECK (value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"timestamp(0) CHECK (value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_TIMESTAMP
.
' NOT NULL'
,
'timestamp NOT NULL'
],
[
Schema
::
TYPE_TIMESTAMP
.
' NOT NULL'
,
'timestamp(0) NOT NULL'
],
[
Schema
::
TYPE_TIME
,
'time'
],
[
Schema
::
TYPE_TIMESTAMP
.
'(4)'
,
'timestamp(4)'
],
[
Schema
::
TYPE_TIME
.
" CHECK(value BETWEEN '12:00:00' AND '13:01:01')"
,
"time CHECK(value BETWEEN '12:00:00' AND '13:01:01')"
],
[
Schema
::
TYPE_TIME
,
'time(0)'
],
[
Schema
::
TYPE_TIME
.
' NOT NULL'
,
'time NOT NULL'
],
[
Schema
::
TYPE_TIME
.
" CHECK (value BETWEEN '12:00:00' AND '13:01:01')"
,
"time(0) CHECK (value BETWEEN '12:00:00' AND '13:01:01')"
],
[
Schema
::
TYPE_TIME
.
' NOT NULL'
,
'time(0) NOT NULL'
],
[
Schema
::
TYPE_DATE
,
'date'
],
[
Schema
::
TYPE_DATE
,
'date'
],
[
Schema
::
TYPE_DATE
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"date CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATE
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"date CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATE
.
' NOT NULL'
,
'date NOT NULL'
],
[
Schema
::
TYPE_DATE
.
' NOT NULL'
,
'date NOT NULL'
],
[
Schema
::
TYPE_BINARY
,
'bytea'
],
[
Schema
::
TYPE_BINARY
,
'bytea'
],
[
Schema
::
TYPE_BOOLEAN
,
'boolean'
],
[
Schema
::
TYPE_BOOLEAN
,
'boolean'
],
[
Schema
::
TYPE_BOOLEAN
.
' NOT NULL DEFAULT
1'
,
'boolean NOT NULL DEFAULT 1
'
],
[
Schema
::
TYPE_BOOLEAN
.
' NOT NULL DEFAULT
TRUE'
,
'boolean NOT NULL DEFAULT TRUE
'
],
[
Schema
::
TYPE_MONEY
,
'numeric(19,4)'
],
[
Schema
::
TYPE_MONEY
,
'numeric(19,4)'
],
[
Schema
::
TYPE_MONEY
.
'(16,2)'
,
'numeric(16,2)'
],
[
Schema
::
TYPE_MONEY
.
'(16,2)'
,
'numeric(16,2)'
],
[
Schema
::
TYPE_MONEY
.
' CHECK (value > 0.0)'
,
'numeric(19,4) CHECK (value > 0.0)'
],
[
Schema
::
TYPE_MONEY
.
' CHECK (value > 0.0)'
,
'numeric(19,4) CHECK (value > 0.0)'
],
...
...
tests/unit/framework/db/sqlite/SqliteQueryBuilderTest.php
View file @
d1a3d400
...
@@ -54,16 +54,16 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
...
@@ -54,16 +54,16 @@ class SqliteQueryBuilderTest extends QueryBuilderTest
[
Schema
::
TYPE_DECIMAL
.
'(12,4) CHECK (value > 5.6)'
,
'decimal(12,4) CHECK (value > 5.6)'
],
[
Schema
::
TYPE_DECIMAL
.
'(12,4) CHECK (value > 5.6)'
,
'decimal(12,4) CHECK (value > 5.6)'
],
[
Schema
::
TYPE_DECIMAL
.
' NOT NULL'
,
'decimal(10,0) NOT NULL'
],
[
Schema
::
TYPE_DECIMAL
.
' NOT NULL'
,
'decimal(10,0) NOT NULL'
],
[
Schema
::
TYPE_DATETIME
,
'datetime'
],
[
Schema
::
TYPE_DATETIME
,
'datetime'
],
[
Schema
::
TYPE_DATETIME
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"datetime CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATETIME
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"datetime CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATETIME
.
' NOT NULL'
,
'datetime NOT NULL'
],
[
Schema
::
TYPE_DATETIME
.
' NOT NULL'
,
'datetime NOT NULL'
],
[
Schema
::
TYPE_TIMESTAMP
,
'timestamp'
],
[
Schema
::
TYPE_TIMESTAMP
,
'timestamp'
],
[
Schema
::
TYPE_TIMESTAMP
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"timestamp CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_TIMESTAMP
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"timestamp CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_TIMESTAMP
.
' NOT NULL'
,
'timestamp NOT NULL'
],
[
Schema
::
TYPE_TIMESTAMP
.
' NOT NULL'
,
'timestamp NOT NULL'
],
[
Schema
::
TYPE_TIME
,
'time'
],
[
Schema
::
TYPE_TIME
,
'time'
],
[
Schema
::
TYPE_TIME
.
" CHECK
(value BETWEEN '12:00:00' AND '13:01:01')"
,
"time CHECK
(value BETWEEN '12:00:00' AND '13:01:01')"
],
[
Schema
::
TYPE_TIME
.
" CHECK
(value BETWEEN '12:00:00' AND '13:01:01')"
,
"time CHECK
(value BETWEEN '12:00:00' AND '13:01:01')"
],
[
Schema
::
TYPE_TIME
.
' NOT NULL'
,
'time NOT NULL'
],
[
Schema
::
TYPE_TIME
.
' NOT NULL'
,
'time NOT NULL'
],
[
Schema
::
TYPE_DATE
,
'date'
],
[
Schema
::
TYPE_DATE
,
'date'
],
[
Schema
::
TYPE_DATE
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"date CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATE
.
" CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
,
"date CHECK
(value BETWEEN '2011-01-01' AND '2013-01-01')"
],
[
Schema
::
TYPE_DATE
.
' NOT NULL'
,
'date NOT NULL'
],
[
Schema
::
TYPE_DATE
.
' NOT NULL'
,
'date NOT NULL'
],
[
Schema
::
TYPE_BINARY
,
'blob'
],
[
Schema
::
TYPE_BINARY
,
'blob'
],
[
Schema
::
TYPE_BOOLEAN
,
'boolean'
],
[
Schema
::
TYPE_BOOLEAN
,
'boolean'
],
...
...
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