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
94e5ce73
Commit
94e5ce73
authored
Feb 17, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more tests
parent
9f42b875
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
17 deletions
+26
-17
MysqlTestCase.php
tests/Export/MysqlTestCase.php
+10
-14
OracleTestCase.php
tests/Export/OracleTestCase.php
+16
-3
No files found.
tests/Export/MysqlTestCase.php
View file @
94e5ce73
...
@@ -32,11 +32,6 @@
...
@@ -32,11 +32,6 @@
*/
*/
class
Doctrine_Export_Mysql_TestCase
extends
Doctrine_UnitTestCase
class
Doctrine_Export_Mysql_TestCase
extends
Doctrine_UnitTestCase
{
{
public
function
__construct
()
{
parent
::
__construct
(
'mysql'
);
}
public
function
testAlterTableThrowsExceptionWithoutValidTableName
()
public
function
testAlterTableThrowsExceptionWithoutValidTableName
()
{
{
try
{
try
{
...
@@ -259,11 +254,12 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
...
@@ -259,11 +254,12 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mysql_index_test_record (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, FULLTEXT INDEX content_idx (content), UNIQUE INDEX namecode_idx (name, code), PRIMARY KEY(id)) ENGINE = MYISAM'
);
}
}
public
function
testExportSupportsForeignKeys
()
public
function
testExportSupportsForeignKeys
()
{
{
$r
=
new
MysqlForeignKeyTest
;
$r
=
new
MysqlForeignKeyTest
;
//print $this->adapter->pop();
//$this->assertEqual($this->adapter->pop());
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mysql_foreign_key_test (id BIGINT AUTO_INCREMENT, name TEXT, code INT, content TEXT, parent_id BIGINT, FOREIGN KEY id REFERENCES mysql_foreign_key_test(parent_id) ON UPDATE RESTRICT ON DELETE CASCADE, PRIMARY KEY(id)) ENGINE = INNODB'
);
}
}
}
}
class
MysqlForeignKeyTest
extends
Doctrine_Record
class
MysqlForeignKeyTest
extends
Doctrine_Record
...
@@ -275,10 +271,10 @@ class MysqlForeignKeyTest extends Doctrine_Record
...
@@ -275,10 +271,10 @@ class MysqlForeignKeyTest extends Doctrine_Record
$this
->
hasColumn
(
'content'
,
'string'
,
4000
);
$this
->
hasColumn
(
'content'
,
'string'
,
4000
);
$this
->
hasColumn
(
'parent_id'
,
'integer'
);
$this
->
hasColumn
(
'parent_id'
,
'integer'
);
$this
->
foreignKey
(
array
(
'local'
=>
'id'
,
$this
->
hasMany
(
'MysqlForeignKeyTest as Children'
,
'foreign'
=>
'
parent_id'
,
'MysqlForeignKeyTest.
parent_id'
,
'foreignTable'
=>
'mysql_foreign_key_test
'
,
array
(
'onDelete'
=>
'CASCADE
'
,
'onDelete'
=>
'CASCADE
'
)
'onUpdate'
=>
'RESTRICT
'
)
);
);
$this
->
option
(
'type'
,
'INNODB'
);
$this
->
option
(
'type'
,
'INNODB'
);
...
...
tests/Export/OracleTestCase.php
View file @
94e5ce73
...
@@ -123,6 +123,19 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
...
@@ -123,6 +123,19 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
$this
->
adapter
->
pop
();
$this
->
adapter
->
pop
();
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id CHAR(3))'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id CHAR(3))'
);
}
}
public
function
testCreateTableSupportsUniqueConstraint
()
{
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
,
'autoincrement'
=>
true
,
'unique'
=>
true
),
'name'
=>
array
(
'type'
=>
'string'
,
'length'
=>
4
),
);
$options
=
array
(
'primary'
=>
array
(
'id'
),
);
$sql
=
$this
->
export
->
createTableSql
(
'sometable'
,
$fields
,
$options
);
$this
->
assertEqual
(
$sql
,
'CREATE TABLE sometable (id INT UNIQUE, name VARCHAR2(4), PRIMARY KEY(id))'
);
}
public
function
testCreateTableSupportsIndexes
()
public
function
testCreateTableSupportsIndexes
()
{
{
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
,
'autoincrement'
=>
true
,
'unique'
=>
true
),
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
,
'autoincrement'
=>
true
,
'unique'
=>
true
),
...
@@ -133,9 +146,9 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
...
@@ -133,9 +146,9 @@ class Doctrine_Export_Oracle_TestCase extends Doctrine_UnitTestCase
'indexes'
=>
array
(
'myindex'
=>
array
(
'fields'
=>
array
(
'id'
,
'name'
)))
'indexes'
=>
array
(
'myindex'
=>
array
(
'fields'
=>
array
(
'id'
,
'name'
)))
);
);
$sql
=
$this
->
export
->
createTableSql
(
'sometable'
,
$fields
,
$options
);
$sql
=
$this
->
export
->
createTableSql
(
'sometable'
,
$fields
,
$options
);
$this
->
assertEqual
(
$sql
,
'CREATE TABLE sometable (id INT
EGER UNSIGNED PRIMARY KEY AUTOINCREMENT, name VARCHAR(4
), INDEX myindex (id, name))'
);
$this
->
assertEqual
(
$sql
,
'CREATE TABLE sometable (id INT
UNIQUE, name VARCHAR2(4), PRIMARY KEY(id
), INDEX myindex (id, name))'
);
}
}
}
}
?>
?>
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