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
e9c61a56
Commit
e9c61a56
authored
Jun 19, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
a7632ff7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
37 deletions
+54
-37
SelectTestCase.php
tests/Query/SelectTestCase.php
+6
-0
UnitTestCase.php
tests/UnitTestCase.php
+43
-33
run.php
tests/run.php
+5
-4
No files found.
tests/Query/SelectTestCase.php
View file @
e9c61a56
...
...
@@ -43,6 +43,7 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
$users
=
$q
->
execute
();
$this
->
assertEqual
(
$users
[
0
]
->
value
,
'zYne zYne@example.com'
);
}
public
function
testSelectDistinctIsSupported
()
{
$q
=
new
Doctrine_Query
();
...
...
@@ -51,6 +52,7 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$q
->
getSql
(),
"SELECT DISTINCT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)"
);
}
public
function
testSelectDistinctIsSupported2
()
{
$q
=
new
Doctrine_Query
();
...
...
@@ -59,6 +61,7 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$q
->
getSql
(),
"SELECT DISTINCT e.id AS e__id, e.name AS e__name FROM entity e WHERE (e.type = 0)"
);
}
public
function
testAggregateFunctionWithDistinctKeyword
()
{
$q
=
new
Doctrine_Query
();
...
...
@@ -67,6 +70,7 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$q
->
getQuery
(),
'SELECT COUNT(DISTINCT e.name) AS e__0 FROM entity e WHERE (e.type = 0)'
);
}
public
function
testAggregateFunction
()
{
$q
=
new
Doctrine_Query
();
...
...
@@ -110,6 +114,8 @@ class Doctrine_Query_Select_TestCase extends Doctrine_UnitTestCase
try
{
$q
->
parseQuery
(
'SELECT UNKNOWN(u.id) FROM User'
);
$q
->
getQuery
();
$this
->
fail
();
}
catch
(
Doctrine_Query_Exception
$e
)
{
$this
->
pass
();
...
...
tests/UnitTestCase.php
View file @
e9c61a56
...
...
@@ -30,7 +30,8 @@
* @since 1.0
* @version $Revision$
*/
class
Doctrine_UnitTestCase
extends
UnitTestCase
{
class
Doctrine_UnitTestCase
extends
UnitTestCase
{
protected
$manager
;
protected
$connection
;
protected
$objTable
;
...
...
@@ -55,11 +56,11 @@ class Doctrine_UnitTestCase extends UnitTestCase {
protected
$init
=
false
;
public
function
init
()
{
public
function
init
()
{
$name
=
get_class
(
$this
);
$this
->
manager
=
Doctrine_Manager
::
getInstance
();
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_FETCHMODE
,
Doctrine
::
FETCH_IMMEDIATE
);
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_EXPORT
,
Doctrine
::
EXPORT_ALL
);
$this
->
tables
=
array_merge
(
$this
->
tables
,
...
...
@@ -86,32 +87,35 @@ class Doctrine_UnitTestCase extends UnitTestCase {
$class
=
get_class
(
$this
);
$e
=
explode
(
'_'
,
$class
);
$this
->
driverName
=
'main'
;
switch
(
$e
[
1
])
{
case
'Export'
:
case
'Import'
:
case
'Expression'
:
case
'Transaction'
:
case
'DataDict'
:
case
'Sequence'
:
$this
->
driverName
=
'Sqlite'
;
break
;
}
if
(
count
(
$e
)
>
3
)
{
$
driver
=
$e
[
2
]
;
switch
(
$e
[
2
])
{
case
'Firebird'
:
case
'
Informix
'
:
case
'
Mysql
'
:
case
'
Mssql
'
:
case
'
Oracle
'
:
case
'
Pgsql
'
:
case
'S
qlit
e'
:
$this
->
driverName
=
$e
[
2
]
;
if
(
!
$this
->
driverName
)
{
$
this
->
driverName
=
'main'
;
switch
(
$e
[
1
])
{
case
'
Export
'
:
case
'
Import
'
:
case
'
Expression
'
:
case
'
Transaction
'
:
case
'
DataDict
'
:
case
'S
equenc
e'
:
$this
->
driverName
=
'Sqlite'
;
break
;
}
if
(
count
(
$e
)
>
3
)
{
$driver
=
$e
[
2
];
switch
(
$e
[
2
])
{
case
'Firebird'
:
case
'Informix'
:
case
'Mysql'
:
case
'Mssql'
:
case
'Oracle'
:
case
'Pgsql'
:
case
'Sqlite'
:
$this
->
driverName
=
$e
[
2
];
break
;
}
}
}
try
{
...
...
@@ -141,7 +145,7 @@ class Doctrine_UnitTestCase extends UnitTestCase {
}
else
{
}
$this
->
listener
=
new
Doctrine_EventListener
_Debugger
();
$this
->
listener
=
new
Doctrine_EventListener
();
$this
->
manager
->
setAttribute
(
Doctrine
::
ATTR_LISTENER
,
$this
->
listener
);
}
if
(
$this
->
driverName
!==
'main'
)
{
...
...
@@ -183,7 +187,8 @@ class Doctrine_UnitTestCase extends UnitTestCase {
$this
->
objTable
=
$this
->
connection
->
getTable
(
'User'
);
}
public
function
prepareData
()
{
public
function
prepareData
()
{
$groups
=
new
Doctrine_Collection
(
$this
->
connection
->
getTable
(
'Group'
));
$groups
[
0
]
->
name
=
'Drama Actors'
;
...
...
@@ -240,10 +245,12 @@ class Doctrine_UnitTestCase extends UnitTestCase {
$this
->
users
=
$users
;
$this
->
connection
->
flush
();
}
public
function
getConnection
()
{
public
function
getConnection
()
{
return
$this
->
connection
;
}
public
function
assertDeclarationType
(
$type
,
$type2
)
{
public
function
assertDeclarationType
(
$type
,
$type2
)
{
$dec
=
$this
->
getDeclaration
(
$type
);
if
(
!
is_array
(
$type2
))
{
...
...
@@ -252,16 +259,19 @@ class Doctrine_UnitTestCase extends UnitTestCase {
$this
->
assertEqual
(
$dec
[
'type'
],
$type2
);
}
public
function
getDeclaration
(
$type
)
{
public
function
getDeclaration
(
$type
)
{
return
$this
->
dataDict
->
getPortableDeclaration
(
array
(
'type'
=>
$type
,
'name'
=>
'colname'
,
'length'
=>
1
,
'fixed'
=>
true
));
}
public
function
clearCache
()
{
public
function
clearCache
()
{
foreach
(
$this
->
tables
as
$name
)
{
$table
=
$this
->
connection
->
getTable
(
$name
);
$table
->
getCache
()
->
deleteAll
();
}
}
public
function
setUp
()
{
public
function
setUp
()
{
if
(
!
$this
->
init
)
{
$this
->
init
();
}
...
...
tests/run.php
View file @
e9c61a56
...
...
@@ -71,7 +71,7 @@ $test = new GroupTest('Doctrine Framework Unit Tests');
/**
$test->addTestCase(new Doctrine_Ticket330_TestCase());
*/
*/
// Connection drivers (not yet fully tested)
$test
->
addTestCase
(
new
Doctrine_Connection_Pgsql_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Connection_Oracle_TestCase
());
...
...
@@ -292,12 +292,13 @@ $test->addTestCase(new Doctrine_Query_Select_TestCase());
$test
->
addTestCase
(
new
Doctrine_Query_JoinCondition_TestCase
());
$test
->
addTestCase
(
new
Doctrine_Query_MultipleAggregateValue_TestCase
());
/**
$test
->
addTestCase
(
new
Doctrine_Query_TestCase
());
/**
//$test->addTestCase(new Doctrine_IntegrityAction_TestCase());
*/
//$test->addTestCase(new Doctrine_AuditLog_TestCase());
// Cache tests
//$test->addTestCase(new Doctrine_Cache_Query_SqliteTestCase());
//$test->addTestCase(new Doctrine_Cache_FileTestCase());
...
...
@@ -306,7 +307,7 @@ $test->addTestCase(new Doctrine_Query_MultipleAggregateValue_TestCase());
//$test->addTestCase(new Doctrine_BatchIterator_TestCase());
//$test->addTestCase(new Doctrine_Hydrate_TestCase());
//$test->addTestCase(new Doctrine_Cache_TestCase());
//$test->addTestCase(new Doctrine_Query_TestCase());
class
MyReporter
extends
HtmlReporter
{
public
function
paintHeader
()
{}
...
...
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