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
41df51a6
Commit
41df51a6
authored
Jul 08, 2009
by
piccoloprincipe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added tests for various WHERE clauses
parent
f11e39cc
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
88 additions
and
0 deletions
+88
-0
UpdateSqlGenerationTest.php
tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php
+88
-0
No files found.
tests/Doctrine/Tests/ORM/Query/UpdateSqlGenerationTest.php
View file @
41df51a6
...
...
@@ -71,4 +71,92 @@ class UpdateSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
'UPDATE cms_users SET name = ?, username = ?'
);
}
public
function
testSupportsWhereClauses
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1 WHERE u.id = ?2'
,
'UPDATE cms_users SET name = ? WHERE id = ?'
);
}
public
function
testSupportsWhereClausesOnTheUpdatedField
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1 WHERE u.name = ?2'
,
'UPDATE cms_users SET name = ? WHERE name = ?'
);
}
public
function
testSupportsMultipleWhereClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1 WHERE u.name = ?2 AND u.status = ?3'
,
'UPDATE cms_users SET name = ? WHERE name = ? AND status = ?'
);
}
public
function
testSupportsInClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1 WHERE u.id IN (1, 3, 4)'
,
'UPDATE cms_users SET name = ? WHERE id IN (1, 3, 4)'
);
}
public
function
testSupportsParametrizedInClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1 WHERE u.id IN (?2, ?3, ?4)'
,
'UPDATE cms_users SET name = ? WHERE id IN (?, ?, ?)'
);
}
public
function
testSupportsNotInClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1 WHERE u.id NOT IN (1, 3, 4)'
,
'UPDATE cms_users SET name = ? WHERE id NOT IN (1, 3, 4)'
);
}
public
function
testSupportsGreatherThanClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.status = ?1 WHERE u.id > ?2'
,
'UPDATE cms_users SET status = ? WHERE id > ?'
);
}
public
function
testSupportsGreatherThanOrEqualToClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.status = ?1 WHERE u.id >= ?2'
,
'UPDATE cms_users SET status = ? WHERE id >= ?'
);
}
public
function
testSupportsLessThanClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.status = ?1 WHERE u.id < ?2'
,
'UPDATE cms_users SET status = ? WHERE id < ?'
);
}
public
function
testSupportsLessThanOrEqualToClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.status = ?1 WHERE u.id <= ?2'
,
'UPDATE cms_users SET status = ? WHERE id <= ?'
);
}
public
function
testSupportsBetweenClause
()
{
$this
->
assertSqlGeneration
(
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.status = ?1 WHERE u.id BETWEEN :from AND :to'
,
'UPDATE cms_users SET status = ? WHERE id BETWEEN ? AND ?'
);
}
}
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