Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Tomáš Trávníček
doctrine-dbal
Commits
9ed1eea1
Commit
9ed1eea1
authored
Nov 27, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More driver tests
parent
8162a684
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
166 additions
and
4 deletions
+166
-4
PgsqlTestCase.php
tests/DataDict/PgsqlTestCase.php
+91
-0
ExportMysqlTestCase.php
tests/ExportMysqlTestCase.php
+75
-4
No files found.
tests/DataDict/PgsqlTestCase.php
View file @
9ed1eea1
...
...
@@ -28,4 +28,95 @@ class Doctrine_DataDict_Pgsql_TestCase extends Doctrine_Driver_UnitTestCase {
$this
->
assertEqual
(
$this
->
getDeclaration
(
'boolean'
),
array
(
array
(
'boolean'
),
1
,
false
,
null
));
}
public
function
testGetNativeDefinitionSupportsIntegerType
()
{
$a
=
array
(
'type'
=>
'integer'
,
'length'
=>
20
,
'fixed'
=>
false
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'BIGINT'
);
$a
[
'length'
]
=
4
;
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'INT'
);
$a
[
'length'
]
=
2
;
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'SMALLINT'
);
}
public
function
testGetNativeDefinitionSupportsIntegerTypeWithAutoinc
()
{
$a
=
array
(
'type'
=>
'integer'
,
'length'
=>
20
,
'fixed'
=>
false
,
'autoincrement'
=>
true
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'BIGSERIAL PRIMARY KEY'
);
$a
[
'length'
]
=
4
;
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'SERIAL PRIMARY KEY'
);
$a
[
'length'
]
=
2
;
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'SERIAL PRIMARY KEY'
);
}
public
function
testGetNativeDefinitionSupportsFloatType
()
{
$a
=
array
(
'type'
=>
'float'
,
'length'
=>
20
,
'fixed'
=>
false
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'FLOAT8'
);
}
public
function
testGetNativeDefinitionSupportsBooleanType
()
{
$a
=
array
(
'type'
=>
'boolean'
,
'fixed'
=>
false
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'BOOLEAN'
);
}
public
function
testGetNativeDefinitionSupportsDateType
()
{
$a
=
array
(
'type'
=>
'date'
,
'fixed'
=>
false
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'DATE'
);
}
public
function
testGetNativeDefinitionSupportsTimestampType
()
{
$a
=
array
(
'type'
=>
'timestamp'
,
'fixed'
=>
false
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'TIMESTAMP without time zone'
);
}
public
function
testGetNativeDefinitionSupportsTimeType
()
{
$a
=
array
(
'type'
=>
'time'
,
'fixed'
=>
false
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'TIME without time zone'
);
}
public
function
testGetNativeDefinitionSupportsClobType
()
{
$a
=
array
(
'type'
=>
'clob'
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'TEXT'
);
}
public
function
testGetNativeDefinitionSupportsBlobType
()
{
$a
=
array
(
'type'
=>
'blob'
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'BYTEA'
);
}
public
function
testGetNativeDefinitionSupportsCharType
()
{
$a
=
array
(
'type'
=>
'char'
,
'length'
=>
10
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'CHAR(10)'
);
}
public
function
testGetNativeDefinitionSupportsVarcharType
()
{
$a
=
array
(
'type'
=>
'varchar'
,
'length'
=>
10
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'VARCHAR(10)'
);
}
public
function
testGetNativeDefinitionSupportsArrayType
()
{
$a
=
array
(
'type'
=>
'array'
,
'length'
=>
40
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'VARCHAR(40)'
);
}
public
function
testGetNativeDefinitionSupportsStringType
()
{
$a
=
array
(
'type'
=>
'string'
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'TEXT'
);
}
public
function
testGetNativeDefinitionSupportsArrayType2
()
{
$a
=
array
(
'type'
=>
'array'
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'TEXT'
);
}
public
function
testGetNativeDefinitionSupportsObjectType
()
{
$a
=
array
(
'type'
=>
'object'
);
$this
->
assertEqual
(
$this
->
dataDict
->
getNativeDeclaration
(
$a
),
'TEXT'
);
}
}
tests/ExportMysqlTestCase.php
View file @
9ed1eea1
...
...
@@ -17,21 +17,92 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
));
$options
=
array
(
'type'
=>
'
foo
'
);
$options
=
array
(
'type'
=>
'
MYISAM
'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id INT
) ENGINE = foo
'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id INT
UNSIGNED) ENGINE = MYISAM
'
);
}
public
function
testCreateTableSupportsAutoincPks
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
,
'autoincrement'
=>
true
));
$options
=
array
(
'type'
=>
'
foo
'
);
$options
=
array
(
'type'
=>
'
INNODB
'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id INT) ENGINE = foo'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY) ENGINE = INNODB'
);
}
public
function
testCreateTableSupportsCharType
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'char'
,
'length'
=>
3
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id CHAR(3)) ENGINE = MYISAM'
);
}
public
function
testCreateTableSupportsCharType2
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'char'
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id CHAR(255)) ENGINE = MYISAM'
);
}
public
function
testCreateTableSupportsVarcharType
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'varchar'
,
'length'
=>
'100'
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id VARCHAR(100)) ENGINE = MYISAM'
);
}
public
function
testCreateTableSupportsIntegerType
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'length'
=>
'10'
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id BIGINT) ENGINE = MYISAM'
);
}
public
function
testCreateTableSupportsBlobType
()
{
$name
=
'mytable'
;
$fields
=
array
(
'content'
=>
array
(
'type'
=>
'blob'
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (content LONGBLOB) ENGINE = MYISAM'
);
}
public
function
testCreateTableSupportsBlobType2
()
{
$name
=
'mytable'
;
$fields
=
array
(
'content'
=>
array
(
'type'
=>
'blob'
,
'length'
=>
2000
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (content BLOB) ENGINE = MYISAM'
);
}
public
function
testCreateTableSupportsBooleanType
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'boolean'
));
$options
=
array
(
'type'
=>
'MYISAM'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id TINYINT(1)) ENGINE = MYISAM'
);
}
public
function
testCreateDatabaseExecutesSql
()
{
$this
->
export
->
createDatabase
(
'db'
);
...
...
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