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
88dfc987
Commit
88dfc987
authored
Jan 10, 2008
by
lsmith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- fixed test cases to expect the || SQL standard syntax
parent
e9803599
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
23 deletions
+23
-23
DriverTestCase.php
tests/Expression/DriverTestCase.php
+1
-1
ExpressionTestCase.php
tests/Query/ExpressionTestCase.php
+22
-22
No files found.
tests/Expression/DriverTestCase.php
View file @
88dfc987
...
...
@@ -96,7 +96,7 @@ class Doctrine_Expression_Driver_TestCase extends Doctrine_UnitTestCase {
$this
->
assertEqual
(
$this
->
expr
->
locate
(
'id'
,
3
),
'LOCATE(id, 3)'
);
}
public
function
testConcatReturnsValidSql
()
{
$this
->
assertEqual
(
$this
->
expr
->
concat
(
'id'
,
'type'
),
'
CONCAT(id, type)
'
);
$this
->
assertEqual
(
$this
->
expr
->
concat
(
'id'
,
'type'
),
'
id || type
'
);
}
public
function
testSubstringReturnsValidSql
()
{
$this
->
assertEqual
(
$this
->
expr
->
substring
(
'id'
,
3
),
'SUBSTRING(id FROM 3)'
);
...
...
tests/Query/ExpressionTestCase.php
View file @
88dfc987
<?php
/*
/*
* $Id$
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
...
...
@@ -30,16 +30,16 @@
* @link www.phpdoctrine.com
* @since 1.0
*/
class
Doctrine_Query_Expression_TestCase
extends
Doctrine_UnitTestCase
class
Doctrine_Query_Expression_TestCase
extends
Doctrine_UnitTestCase
{
public
function
testUnknownExpressionInSelectClauseThrowsException
()
public
function
testUnknownExpressionInSelectClauseThrowsException
()
{
$q
=
new
Doctrine_Query
();
try
{
$q
->
parseQuery
(
'SELECT SOMEUNKNOWNFUNC(u.name, " ", u.loginname) FROM User u'
);
$q
->
getQuery
();
$this
->
fail
();
}
catch
(
Doctrine_Query_Exception
$e
)
{
...
...
@@ -47,13 +47,13 @@ class Doctrine_Query_Expression_TestCase extends Doctrine_UnitTestCase
}
}
public
function
testUnknownColumnWithinFunctionInSelectClauseThrowsException
()
public
function
testUnknownColumnWithinFunctionInSelectClauseThrowsException
()
{
$q
=
new
Doctrine_Query
();
try
{
$q
->
parseQuery
(
'SELECT
CONCAT(u.name, u.unknown)
FROM User u'
);
$q
->
parseQuery
(
'SELECT
u.name || u.unknown
FROM User u'
);
$q
->
execute
();
$this
->
fail
();
}
catch
(
Doctrine_Query_Exception
$e
)
{
...
...
@@ -61,31 +61,31 @@ class Doctrine_Query_Expression_TestCase extends Doctrine_UnitTestCase
}
}
public
function
testConcatIsSupportedInSelectClause
()
public
function
testConcatIsSupportedInSelectClause
()
{
$q
=
new
Doctrine_Query
();
$q
->
parseQuery
(
'SELECT CONCAT(u.name, u.loginname) FROM User u'
);
$this
->
assertEqual
(
$q
->
getQuery
(),
'SELECT
CONCAT(e.name, e.loginname)
AS e__0 FROM entity e WHERE (e.type = 0)'
);
$this
->
assertEqual
(
$q
->
getQuery
(),
'SELECT
e.name || e.loginname
AS e__0 FROM entity e WHERE (e.type = 0)'
);
}
public
function
testConcatInSelectClauseSupportsLiteralStrings
()
public
function
testConcatInSelectClauseSupportsLiteralStrings
()
{
$q
=
new
Doctrine_Query
();
$q
->
parseQuery
(
"SELECT CONCAT(u.name, 'The Man') FROM User u"
);
$this
->
assertEqual
(
$q
->
getQuery
(),
"SELECT
CONCAT(e.name, 'The Man')
AS e__0 FROM entity e WHERE (e.type = 0)"
);
$this
->
assertEqual
(
$q
->
getQuery
(),
"SELECT
e.name || 'The Man'
AS e__0 FROM entity e WHERE (e.type = 0)"
);
}
public
function
testConcatInSelectClauseSupportsMoreThanTwoArgs
()
public
function
testConcatInSelectClauseSupportsMoreThanTwoArgs
()
{
$q
=
new
Doctrine_Query
();
$q
->
parseQuery
(
"SELECT CONCAT(u.name, 'The Man', u.loginname) FROM User u"
);
$this
->
assertEqual
(
$q
->
getQuery
(),
"SELECT
CONCAT(e.name, 'The Man', e.loginname)
AS e__0 FROM entity e WHERE (e.type = 0)"
);
$this
->
assertEqual
(
$q
->
getQuery
(),
"SELECT
e.name || 'The Man' || e.loginname
AS e__0 FROM entity e WHERE (e.type = 0)"
);
}
public
function
testNonPortableFunctionsAreSupported
()
...
...
@@ -99,7 +99,7 @@ class Doctrine_Query_Expression_TestCase extends Doctrine_UnitTestCase
$radius
=
'33'
;
$query
->
select
(
"l.*, i18n.*, GeoDistKM(l.lat, l.lon,
$lat
,
$lon
) distance"
)
->
from
(
'Location l, l.LocationI18n i18n'
)
->
from
(
'Location l, l.LocationI18n i18n'
)
->
where
(
'l.id <> ? AND i18n.culture = ?'
,
array
(
1
,
'en'
))
->
having
(
"distance <
$radius
"
)
->
orderby
(
'distance ASC'
)
...
...
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