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
21e0bd3d
Commit
21e0bd3d
authored
May 24, 2008
by
guilhermeblanco
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes for tests
parent
539853d5
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
20 deletions
+21
-20
Mock.php
lib/Doctrine/Connection/Mock.php
+5
-5
SelectExpression.php
lib/Doctrine/Query/Production/SelectExpression.php
+3
-4
VariableDeclaration.php
lib/Doctrine/Query/Production/VariableDeclaration.php
+2
-0
IdentifierRecognitionTest.php
tests/Orm/Query/IdentifierRecognitionTest.php
+6
-6
LanguageRecognitionTest.php
tests/Orm/Query/LanguageRecognitionTest.php
+5
-5
No files found.
lib/Doctrine/Connection/Mock.php
View file @
21e0bd3d
...
@@ -49,7 +49,7 @@ class Doctrine_Connection_Mock extends Doctrine_Connection_Common
...
@@ -49,7 +49,7 @@ class Doctrine_Connection_Mock extends Doctrine_Connection_Common
}
}
public
function
quote
(
$input
)
public
function
quote
(
$input
,
$type
=
null
)
{
{
return
$input
;
return
$input
;
}
}
...
...
lib/Doctrine/Query/Production/SelectExpression.php
View file @
21e0bd3d
...
@@ -80,7 +80,7 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
...
@@ -80,7 +80,7 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
);
);
}
}
if
(
$this
->
_identificationVariable
!==
null
)
{
/*
if ($this->_identificationVariable !== null) {
if ($this->_leftExpression instanceof Doctrine_Query_Production_PathExpression) {
if ($this->_leftExpression instanceof Doctrine_Query_Production_PathExpression) {
// We bring the queryComponent from the class instance
// We bring the queryComponent from the class instance
// $queryComponent = $this->_leftExpression->getQueryComponent();
// $queryComponent = $this->_leftExpression->getQueryComponent();
...
@@ -95,7 +95,7 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
...
@@ -95,7 +95,7 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
$queryComponent['scalar'][$idx] = $this->_identificationVariable;
$queryComponent['scalar'][$idx] = $this->_identificationVariable;
//$parserResult->setQueryComponent($componentAlias, $queryComponent);
//$parserResult->setQueryComponent($componentAlias, $queryComponent);
}
}
*/
// We need to add scalar in queryComponent the item alias if identificationvariable is set.
// We need to add scalar in queryComponent the item alias if identificationvariable is set.
echo
"SelectExpression:
\n
"
;
echo
"SelectExpression:
\n
"
;
...
@@ -107,8 +107,7 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
...
@@ -107,8 +107,7 @@ class Doctrine_Query_Production_SelectExpression extends Doctrine_Query_Producti
public
function
buildSql
()
public
function
buildSql
()
{
{
return
$this
->
_leftExpression
->
buildSql
()
.
' AS '
return
$this
->
_leftExpression
->
buildSql
();
// . ' AS ' . (($this->_identificationVariable !== null) ? $this->_identificationVariable : '');
.
((
$this
->
_identificationVariable
!==
null
)
?
$this
->
_identificationVariable
:
''
);
}
}
...
...
lib/Doctrine/Query/Production/VariableDeclaration.php
View file @
21e0bd3d
...
@@ -132,6 +132,8 @@ class Doctrine_Query_Production_VariableDeclaration extends Doctrine_Query_Produ
...
@@ -132,6 +132,8 @@ class Doctrine_Query_Production_VariableDeclaration extends Doctrine_Query_Produ
$conn
=
$manager
->
getConnectionForComponent
(
$this
->
_componentName
);
$conn
=
$manager
->
getConnectionForComponent
(
$this
->
_componentName
);
}
}
echo
"Query Component Table Name: "
.
var_export
(
$queryComponent
[
'metadata'
]
->
getTableName
(),
true
)
.
"
\n
"
;
return
$conn
->
quoteIdentifier
(
$queryComponent
[
'metadata'
]
->
getTableName
())
.
' '
return
$conn
->
quoteIdentifier
(
$queryComponent
[
'metadata'
]
->
getTableName
())
.
' '
.
$conn
->
quoteIdentifier
(
$parserResult
->
getTableAliasFromComponentAlias
(
$this
->
_componentAlias
));
.
$conn
->
quoteIdentifier
(
$parserResult
->
getTableAliasFromComponentAlias
(
$this
->
_componentAlias
));
}
}
...
...
tests/Orm/Query/IdentifierRecognitionTest.php
View file @
21e0bd3d
...
@@ -55,7 +55,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
...
@@ -55,7 +55,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
public
function
testSingleAliasDeclarationWithIndexByIsSupported
()
public
function
testSingleAliasDeclarationWithIndexByIsSupported
()
{
{
$query
=
new
Doctrine_Query
;
$query
=
new
Doctrine_Query
;
$query
->
setDql
(
'SELECT u.* FROM CmsUser u INDEX BY
name
'
);
$query
->
setDql
(
'SELECT u.* FROM CmsUser u INDEX BY
id
'
);
$parserResult
=
$query
->
parse
();
$parserResult
=
$query
->
parse
();
$decl
=
$parserResult
->
getQueryComponent
(
'u'
);
$decl
=
$parserResult
->
getQueryComponent
(
'u'
);
...
@@ -64,13 +64,13 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
...
@@ -64,13 +64,13 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
$this
->
assertEquals
(
null
,
$decl
[
'relation'
]);
$this
->
assertEquals
(
null
,
$decl
[
'relation'
]);
$this
->
assertEquals
(
null
,
$decl
[
'parent'
]);
$this
->
assertEquals
(
null
,
$decl
[
'parent'
]);
$this
->
assertEquals
(
null
,
$decl
[
'agg'
]);
$this
->
assertEquals
(
null
,
$decl
[
'agg'
]);
$this
->
assertEquals
(
'
name
'
,
$decl
[
'map'
]);
$this
->
assertEquals
(
'
id
'
,
$decl
[
'map'
]);
}
}
public
function
testQueryParserSupportsMultipleAliasDeclarations
()
public
function
testQueryParserSupportsMultipleAliasDeclarations
()
{
{
$query
=
new
Doctrine_Query
;
$query
=
new
Doctrine_Query
;
$query
->
setDql
(
'SELECT u.* FROM CmsUser u INDEX BY
name
LEFT JOIN u.phonenumbers p'
);
$query
->
setDql
(
'SELECT u.* FROM CmsUser u INDEX BY
id
LEFT JOIN u.phonenumbers p'
);
$parserResult
=
$query
->
parse
();
$parserResult
=
$query
->
parse
();
$decl
=
$parserResult
->
getQueryComponent
(
'u'
);
$decl
=
$parserResult
->
getQueryComponent
(
'u'
);
...
@@ -79,7 +79,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
...
@@ -79,7 +79,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
$this
->
assertEquals
(
null
,
$decl
[
'relation'
]);
$this
->
assertEquals
(
null
,
$decl
[
'relation'
]);
$this
->
assertEquals
(
null
,
$decl
[
'parent'
]);
$this
->
assertEquals
(
null
,
$decl
[
'parent'
]);
$this
->
assertEquals
(
null
,
$decl
[
'agg'
]);
$this
->
assertEquals
(
null
,
$decl
[
'agg'
]);
$this
->
assertEquals
(
'
name
'
,
$decl
[
'map'
]);
$this
->
assertEquals
(
'
id
'
,
$decl
[
'map'
]);
$decl
=
$parserResult
->
getQueryComponent
(
'p'
);
$decl
=
$parserResult
->
getQueryComponent
(
'p'
);
...
@@ -94,7 +94,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
...
@@ -94,7 +94,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
public
function
testQueryParserSupportsMultipleAliasDeclarationsWithIndexBy
()
public
function
testQueryParserSupportsMultipleAliasDeclarationsWithIndexBy
()
{
{
$query
=
new
Doctrine_Query
;
$query
=
new
Doctrine_Query
;
$query
->
setDql
(
'SELECT u.* FROM CmsUser u INDEX BY
name
LEFT JOIN u.articles a INNER JOIN u.phonenumbers pn INDEX BY phonenumber'
);
$query
->
setDql
(
'SELECT u.* FROM CmsUser u INDEX BY
id
LEFT JOIN u.articles a INNER JOIN u.phonenumbers pn INDEX BY phonenumber'
);
$parserResult
=
$query
->
parse
();
$parserResult
=
$query
->
parse
();
$decl
=
$parserResult
->
getQueryComponent
(
'u'
);
$decl
=
$parserResult
->
getQueryComponent
(
'u'
);
...
@@ -103,7 +103,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
...
@@ -103,7 +103,7 @@ class Orm_Query_IdentifierRecognitionTest extends Doctrine_OrmTestCase
$this
->
assertEquals
(
null
,
$decl
[
'relation'
]);
$this
->
assertEquals
(
null
,
$decl
[
'relation'
]);
$this
->
assertEquals
(
null
,
$decl
[
'parent'
]);
$this
->
assertEquals
(
null
,
$decl
[
'parent'
]);
$this
->
assertEquals
(
null
,
$decl
[
'agg'
]);
$this
->
assertEquals
(
null
,
$decl
[
'agg'
]);
$this
->
assertEquals
(
'
name
'
,
$decl
[
'map'
]);
$this
->
assertEquals
(
'
id
'
,
$decl
[
'map'
]);
$decl
=
$parserResult
->
getQueryComponent
(
'a'
);
$decl
=
$parserResult
->
getQueryComponent
(
'a'
);
...
...
tests/Orm/Query/LanguageRecognitionTest.php
View file @
21e0bd3d
...
@@ -222,12 +222,12 @@ class Orm_Query_LanguageRecognitionTest extends Doctrine_OrmTestCase
...
@@ -222,12 +222,12 @@ class Orm_Query_LanguageRecognitionTest extends Doctrine_OrmTestCase
{
{
$this
->
assertValidDql
(
'SELECT u.name, a.topic, p.phonenumber FROM CmsUser u INNER JOIN u.articles a LEFT JOIN u.phonenumbers p'
);
$this
->
assertValidDql
(
'SELECT u.name, a.topic, p.phonenumber FROM CmsUser u INNER JOIN u.articles a LEFT JOIN u.phonenumbers p'
);
}
}
/*
public function testMixingOfJoins2()
public function testMixingOfJoins2()
{
{
$this->assertValidDql('SELECT u.name, u.articles.topic, c.text FROM CmsUser u INNER JOIN u.articles.comments c');
$this->assertValidDql('SELECT u.name, u.articles.topic, c.text FROM CmsUser u INNER JOIN u.articles.comments c');
}
}
*/
public
function
testOrderBySingleColumn
()
public
function
testOrderBySingleColumn
()
{
{
$this
->
assertValidDql
(
'SELECT u.name FROM CmsUser u ORDER BY u.name'
);
$this
->
assertValidDql
(
'SELECT u.name FROM CmsUser u ORDER BY u.name'
);
...
@@ -287,17 +287,17 @@ class Orm_Query_LanguageRecognitionTest extends Doctrine_OrmTestCase
...
@@ -287,17 +287,17 @@ class Orm_Query_LanguageRecognitionTest extends Doctrine_OrmTestCase
public
function
testIndexByClauseWithOneComponent
()
public
function
testIndexByClauseWithOneComponent
()
{
{
$this
->
assertValidDql
(
'SELECT * FROM CmsUser u INDEX BY
name
'
);
$this
->
assertValidDql
(
'SELECT * FROM CmsUser u INDEX BY
id
'
);
}
}
public
function
testIndexBySupportsJoins
()
public
function
testIndexBySupportsJoins
()
{
{
$this
->
assertValidDql
(
'SELECT * FROM CmsUser u LEFT JOIN u.articles INDEX BY
topic'
);
$this
->
assertValidDql
(
'SELECT * FROM CmsUser u LEFT JOIN u.articles INDEX BY
id'
);
// INDEX BY is now referring to articles
}
}
public
function
testIndexBySupportsJoins2
()
public
function
testIndexBySupportsJoins2
()
{
{
$this
->
assertValidDql
(
'SELECT * FROM CmsUser u INDEX BY
name
LEFT JOIN u.phonenumbers p INDEX BY phonenumber'
);
$this
->
assertValidDql
(
'SELECT * FROM CmsUser u INDEX BY
id
LEFT JOIN u.phonenumbers p INDEX BY phonenumber'
);
}
}
public
function
testBetweenExpressionSupported
()
public
function
testBetweenExpressionSupported
()
...
...
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