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
f11e39cc
Commit
f11e39cc
authored
Jul 08, 2009
by
piccoloprincipe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed and separated test methods to conform to agile documentation (addresses #2316)
parent
32363a20
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
92 additions
and
44 deletions
+92
-44
DeleteSqlGenerationTest.php
tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php
+56
-14
SelectSqlGenerationTest.php
tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
+31
-28
UpdateSqlGenerationTest.php
tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php
+5
-2
No files found.
tests/Doctrine/Tests/ORM/Query/DeleteSqlGenerationTest.php
View file @
f11e39cc
...
...
@@ -56,19 +56,23 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
}
}
public
function
test
WithoutWhere
()
public
function
test
SupportsDeleteWithoutWhereAndFrom
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u'
,
'DELETE FROM cms_users'
);
}
public
function
testSupportsDeleteWithoutWhere
()
{
$this
->
assertSqlGeneration
(
'DELETE FROM Doctrine\Tests\Models\CMS\CmsUser u'
,
'DELETE FROM cms_users'
);
}
public
function
test
WithWher
e
()
public
function
test
SupportsWhereClaus
e
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1'
,
...
...
@@ -76,13 +80,16 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
public
function
test
WithConditional
Expressions
()
public
function
test
SupportsWhereOr
Expressions
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ?1 OR u.name = ?2'
,
'DELETE FROM cms_users WHERE username = ? OR name = ?'
);
}
public
function
testSupportsWhereNestedConditionalExpressions
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1 OR ( u.username = ?2 OR u.name = ?3)'
,
'DELETE FROM cms_users WHERE id = ? OR (username = ? OR name = ?)'
...
...
@@ -94,7 +101,7 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
//);
}
public
function
test
Parser
IsCaseAgnostic
()
public
function
testIsCaseAgnostic
()
{
$this
->
assertSqlGeneration
(
"delete from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1"
,
...
...
@@ -102,7 +109,7 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
public
function
test
WithConditionalTerms
()
public
function
test
SupportsAndCondition
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ?1 AND u.name = ?2"
,
...
...
@@ -110,125 +117,160 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
);
}
public
function
test
WithConditionalFactors
()
public
function
test
SupportsWhereNot
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT u.id != ?1"
,
"DELETE FROM cms_users WHERE NOT id <> ?"
);
}
public
function
testSupportsWhereNotWithParentheses
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT ( u.id != ?1 )"
,
"DELETE FROM cms_users WHERE NOT (id <> ?)"
);
}
public
function
testSupportsWhereNotWithAndExpression
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT ( u.id != ?1 AND u.username = ?2 )"
,
"DELETE FROM cms_users WHERE NOT (id <> ? AND username = ?)"
);
}
// ConditionalPrimary was already tested (see test
DeleteWithWhere() and testDeleteWithConditionalFactors
())
// ConditionalPrimary was already tested (see test
SupportsWhereClause() and testSupportsWhereNot
())
public
function
test
WithExprAndComparison
()
public
function
test
SupportsGreaterThanComparisonClause
()
{
// id = ? was already tested (see testDeleteWithWhere())
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id > ?1"
,
"DELETE FROM cms_users WHERE id > ?"
);
}
public
function
testSupportsGreaterThanOrEqualToComparisonClause
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id >= ?1"
,
"DELETE FROM cms_users WHERE id >= ?"
);
}
public
function
testSupportsLessThanComparisonClause
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id < ?1"
,
"DELETE FROM cms_users WHERE id < ?"
);
}
public
function
testSupportsLessThanOrEqualToComparisonClause
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id <= ?1"
,
"DELETE FROM cms_users WHERE id <= ?"
);
}
public
function
testSupportsNotEqualToComparisonClause
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id <> ?1"
,
"DELETE FROM cms_users WHERE id <> ?"
);
}
public
function
testSupportsNotEqualToComparisonClauseExpressedWithExclamationMark
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id != ?1"
,
"DELETE FROM cms_users WHERE id <> ?"
);
}
public
function
test
WithExprAndBetween
()
public
function
test
SupportsNotBetweenClause
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT BETWEEN ?1 AND ?2"
,
"DELETE FROM cms_users WHERE id NOT BETWEEN ? AND ?"
);
}
public
function
testSupportsBetweenClauseUsedWithAndClause
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id BETWEEN ?1 AND ?2 AND u.username != ?3"
,
"DELETE FROM cms_users WHERE id BETWEEN ? AND ? AND username <> ?"
);
}
public
function
test
WithExprAndLik
e
()
public
function
test
SupportsNotLikeClaus
e
()
{
// "WHERE" Expression LikeExpression
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username NOT LIKE ?1'
,
'DELETE FROM cms_users WHERE username NOT LIKE ?'
);
}
public
function
testSupportsLikeClauseWithEscapeExpression
()
{
$this
->
assertSqlGeneration
(
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username LIKE ?1 ESCAPE '
\\
'"
,
"DELETE FROM cms_users WHERE username LIKE ? ESCAPE '
\\
'"
);
}
public
function
test
WithExprAndNull
()
public
function
test
SupportsIsNullClause
()
{
// "WHERE" Expression NullComparisonExpression
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IS NULL'
,
'DELETE FROM cms_users WHERE name IS NULL'
);
}
public
function
testSupportsIsNotNullClause
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IS NOT NULL'
,
'DELETE FROM cms_users WHERE name IS NOT NULL'
);
}
public
function
test
WithPrimaryAsAtom
()
public
function
test
SupportsAtomExpressionAsClause
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE 1 = 1'
,
'DELETE FROM cms_users WHERE 1 = 1'
);
}
public
function
testSupportsParameterizedAtomExpression
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE ?1 = 1'
,
'DELETE FROM cms_users WHERE ? = 1'
);
}
public
function
test
WithExprAndIn
()
public
function
test
SupportsInClause
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN ( ?1, ?2, ?3, ?4 )'
,
'DELETE FROM cms_users WHERE id IN (?, ?, ?, ?)'
);
}
public
function
testSupportsNotInClause
()
{
$this
->
assertSqlGeneration
(
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN ( ?1, ?2 )'
,
'DELETE FROM cms_users WHERE id NOT IN (?, ?)'
);
}
}
tests/Doctrine/Tests/ORM/Query/SelectSqlGenerationTest.php
View file @
f11e39cc
This diff is collapsed.
Click to expand it.
tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php
View file @
f11e39cc
...
...
@@ -56,16 +56,19 @@ class UpdateSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
}
}
public
function
testWithoutWhere
()
public
function
test
SupportsQueries
WithoutWhere
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1'
,
'UPDATE cms_users SET name = ?'
);
}
public
function
testSupportsMultipleFieldsWithoutWhere
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1, u.username = ?2'
,
'UPDATE cms_users SET name = ?, username = ?'
);
}
}
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