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
01efe0ed
Commit
01efe0ed
authored
Nov 24, 2006
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated driver tests
parent
41e5b466
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
8 deletions
+40
-8
DataDictSqliteTestCase.php
tests/DataDictSqliteTestCase.php
+2
-0
DriverTestCase.php
tests/DriverTestCase.php
+22
-4
ExportMysqlTestCase.php
tests/ExportMysqlTestCase.php
+16
-4
No files found.
tests/DataDictSqliteTestCase.php
View file @
01efe0ed
<?php
/**
class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
private $dict;
...
...
@@ -59,4 +60,5 @@ class Doctrine_DataDict_Sqlite_TestCase extends Doctrine_UnitTestCase {
$this->assertEqual($this->columns['col_real']->getName(), 'col_real');
}
}
*/
?>
tests/DriverTestCase.php
View file @
01efe0ed
...
...
@@ -66,23 +66,41 @@ class Doctrine_Driver_UnitTestCase extends UnitTestCase {
protected
$transaction
;
public
function
__construct
(
$driverName
,
$generic
=
false
)
{
$this
->
driverName
=
$driverName
;
$this
->
generic
=
$generic
;
}
public
function
assertDeclarationType
(
$type
,
$type2
)
{
$dec
=
$this
->
getDeclaration
(
$type
);
if
(
!
is_array
(
$type2
))
$type2
=
array
(
$type2
);
$this
->
assertEqual
(
$dec
[
0
],
$type2
);
}
public
function
getDeclaration
(
$type
)
{
return
$this
->
dataDict
->
getDoctrineDeclaration
(
array
(
'type'
=>
$type
,
'name'
=>
'colname'
,
'length'
=>
1
,
'fixed'
=>
true
));
}
public
function
init
()
{
$this
->
adapter
=
new
AdapterMock
(
$this
->
driverName
);
$this
->
manager
=
Doctrine_Manager
::
getInstance
();
$this
->
manager
->
setDefaultAttributes
();
$this
->
conn
=
$this
->
manager
->
openConnection
(
$this
->
adapter
);
if
(
!
$this
->
generic
)
{
$this
->
export
=
$this
->
conn
->
export
;
$name
=
$this
->
adapter
->
getName
();
if
(
$this
->
adapter
->
getName
()
==
'oci'
)
$tx
=
'Doctrine_Transaction_Oracle'
;
else
$tx
=
'Doctrine_Transaction_'
.
ucwords
(
$this
->
adapter
->
getName
());
$name
=
'Oracle'
;
$tx
=
'Doctrine_Transaction_'
.
ucwords
(
$name
);
$dataDict
=
'Doctrine_DataDict_'
.
ucwords
(
$name
);
if
(
class_exists
(
$tx
))
$this
->
transaction
=
new
$tx
(
$this
->
conn
);
$this
->
transaction
=
new
$tx
(
$this
->
conn
);
if
(
class_exists
(
$dataDict
))
{
$this
->
dataDict
=
new
$dataDict
(
$this
->
conn
);
}
//$this->dataDict = $this->conn->dataDict;
}
else
{
$this
->
export
=
new
Doctrine_Export
(
$this
->
conn
);
...
...
tests/ExportMysqlTestCase.php
View file @
01efe0ed
...
...
@@ -16,11 +16,22 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
public
function
testCreateTableExecutesSql
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
));
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
));
$options
=
array
(
'type'
=>
'foo'
);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id INT) ENGINE = foo'
);
}
public
function
testCreateTableSupportsAutoincPks
()
{
$name
=
'mytable'
;
$fields
=
array
(
'id'
=>
array
(
'type'
=>
'integer'
,
'unsigned'
=>
1
,
'autoincrement'
=>
true
));
$options
=
array
(
'type'
=>
'foo'
);
//$this->export->createTable($name, $fields, $options);
$this
->
export
->
createTable
(
$name
,
$fields
,
$options
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'CREATE TABLE mytable (id INT) ENGINE = foo'
);
}
public
function
testCreateDatabaseExecutesSql
()
{
$this
->
export
->
createDatabase
(
'db'
);
...
...
@@ -35,8 +46,9 @@ class Doctrine_Export_Mysql_TestCase extends Doctrine_Driver_UnitTestCase {
public
function
testDropIndexExecutesSql
()
{
$this
->
export
->
dropIndex
(
'sometable'
,
'relevancy'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'DROP INDEX relevancy ON sometable'
);
$this
->
assertEqual
(
$this
->
adapter
->
pop
(),
'DROP INDEX relevancy
_idx
ON sometable'
);
}
}
?>
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