renamed and separated test methods to conform to agile documentation (addresses #2316)
This commit is contained in:
parent
32363a200d
commit
f11e39cc5a
@ -56,19 +56,23 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithoutWhere()
|
public function testSupportsDeleteWithoutWhereAndFrom()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
'DELETE FROM cms_users'
|
'DELETE FROM cms_users'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsDeleteWithoutWhere()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'DELETE FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
'DELETE FROM cms_users'
|
'DELETE FROM cms_users'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithWhere()
|
public function testSupportsWhereClause()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1',
|
||||||
@ -76,13 +80,16 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithConditionalExpressions()
|
public function testSupportsWhereOrExpressions()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ?1 OR u.name = ?2',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ?1 OR u.name = ?2',
|
||||||
'DELETE FROM cms_users WHERE username = ? OR name = ?'
|
'DELETE FROM cms_users WHERE username = ? OR name = ?'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsWhereNestedConditionalExpressions()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id = ?1 OR ( u.username = ?2 OR u.name = ?3)',
|
'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 = ?)'
|
'DELETE FROM cms_users WHERE id = ? OR (username = ? OR name = ?)'
|
||||||
@ -94,7 +101,7 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
//);
|
//);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testParserIsCaseAgnostic()
|
public function testIsCaseAgnostic()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"delete from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1",
|
"delete from Doctrine\Tests\Models\CMS\CmsUser u where u.username = ?1",
|
||||||
@ -102,7 +109,7 @@ class DeleteSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithConditionalTerms()
|
public function testSupportsAndCondition()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username = ?1 AND u.name = ?2",
|
"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 testWithConditionalFactors()
|
public function testSupportsWhereNot()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT u.id != ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT u.id != ?1",
|
||||||
"DELETE FROM cms_users WHERE NOT id <> ?"
|
"DELETE FROM cms_users WHERE NOT id <> ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsWhereNotWithParentheses()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT ( u.id != ?1 )",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT ( u.id != ?1 )",
|
||||||
"DELETE FROM cms_users WHERE NOT (id <> ?)"
|
"DELETE FROM cms_users WHERE NOT (id <> ?)"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsWhereNotWithAndExpression()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE NOT ( u.id != ?1 AND u.username = ?2 )",
|
"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 = ?)"
|
"DELETE FROM cms_users WHERE NOT (id <> ? AND username = ?)"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConditionalPrimary was already tested (see testDeleteWithWhere() and testDeleteWithConditionalFactors())
|
// ConditionalPrimary was already tested (see testSupportsWhereClause() and testSupportsWhereNot())
|
||||||
|
|
||||||
public function testWithExprAndComparison()
|
public function testSupportsGreaterThanComparisonClause()
|
||||||
{
|
{
|
||||||
// id = ? was already tested (see testDeleteWithWhere())
|
// id = ? was already tested (see testDeleteWithWhere())
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id > ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id > ?1",
|
||||||
"DELETE FROM cms_users WHERE id > ?"
|
"DELETE FROM cms_users WHERE id > ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsGreaterThanOrEqualToComparisonClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id >= ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id >= ?1",
|
||||||
"DELETE FROM cms_users WHERE id >= ?"
|
"DELETE FROM cms_users WHERE id >= ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsLessThanComparisonClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id < ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id < ?1",
|
||||||
"DELETE FROM cms_users WHERE id < ?"
|
"DELETE FROM cms_users WHERE id < ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsLessThanOrEqualToComparisonClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id <= ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id <= ?1",
|
||||||
"DELETE FROM cms_users WHERE id <= ?"
|
"DELETE FROM cms_users WHERE id <= ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsNotEqualToComparisonClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id <> ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id <> ?1",
|
||||||
"DELETE FROM cms_users WHERE id <> ?"
|
"DELETE FROM cms_users WHERE id <> ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsNotEqualToComparisonClauseExpressedWithExclamationMark()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id != ?1",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id != ?1",
|
||||||
"DELETE FROM cms_users WHERE id <> ?"
|
"DELETE FROM cms_users WHERE id <> ?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithExprAndBetween()
|
public function testSupportsNotBetweenClause()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT BETWEEN ?1 AND ?2",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT BETWEEN ?1 AND ?2",
|
||||||
"DELETE FROM cms_users WHERE id NOT BETWEEN ? AND ?"
|
"DELETE FROM cms_users WHERE id NOT BETWEEN ? AND ?"
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsBetweenClauseUsedWithAndClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id BETWEEN ?1 AND ?2 AND u.username != ?3",
|
"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 <> ?"
|
"DELETE FROM cms_users WHERE id BETWEEN ? AND ? AND username <> ?"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithExprAndLike()
|
public function testSupportsNotLikeClause()
|
||||||
{
|
{
|
||||||
// "WHERE" Expression LikeExpression
|
// "WHERE" Expression LikeExpression
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username NOT LIKE ?1',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username NOT LIKE ?1',
|
||||||
'DELETE FROM cms_users WHERE username NOT LIKE ?'
|
'DELETE FROM cms_users WHERE username NOT LIKE ?'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsLikeClauseWithEscapeExpression()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username LIKE ?1 ESCAPE '\\'",
|
"DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.username LIKE ?1 ESCAPE '\\'",
|
||||||
"DELETE FROM cms_users WHERE username LIKE ? ESCAPE '\\'"
|
"DELETE FROM cms_users WHERE username LIKE ? ESCAPE '\\'"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithExprAndNull()
|
public function testSupportsIsNullClause()
|
||||||
{
|
{
|
||||||
// "WHERE" Expression NullComparisonExpression
|
// "WHERE" Expression NullComparisonExpression
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IS NULL',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IS NULL',
|
||||||
'DELETE FROM cms_users WHERE name IS NULL'
|
'DELETE FROM cms_users WHERE name IS NULL'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsIsNotNullClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IS NOT NULL',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name IS NOT NULL',
|
||||||
'DELETE FROM cms_users WHERE name IS NOT NULL'
|
'DELETE FROM cms_users WHERE name IS NOT NULL'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithPrimaryAsAtom()
|
public function testSupportsAtomExpressionAsClause()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE 1 = 1',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE 1 = 1',
|
||||||
'DELETE FROM cms_users WHERE 1 = 1'
|
'DELETE FROM cms_users WHERE 1 = 1'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsParameterizedAtomExpression()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE ?1 = 1',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE ?1 = 1',
|
||||||
'DELETE FROM cms_users WHERE ? = 1'
|
'DELETE FROM cms_users WHERE ? = 1'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithExprAndIn()
|
public function testSupportsInClause()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN ( ?1, ?2, ?3, ?4 )',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN ( ?1, ?2, ?3, ?4 )',
|
||||||
'DELETE FROM cms_users WHERE id IN (?, ?, ?, ?)'
|
'DELETE FROM cms_users WHERE id IN (?, ?, ?, ?)'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsNotInClause()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN ( ?1, ?2 )',
|
'DELETE Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN ( ?1, ?2 )',
|
||||||
'DELETE FROM cms_users WHERE id NOT IN (?, ?)'
|
'DELETE FROM cms_users WHERE id NOT IN (?, ?)'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -26,20 +26,23 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPlainFromClauseWithoutAlias()
|
public function testSupportsSelectForAllFields()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_'
|
'SELECT c0_.id AS id0, c0_.status AS status1, c0_.username AS username2, c0_.name AS name3 FROM cms_users c0_'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsSelectForOneField()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
'SELECT c0_.id AS id0 FROM cms_users c0_'
|
'SELECT c0_.id AS id0 FROM cms_users c0_'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSelectSingleComponentWithMultipleColumns()
|
public function testSupportsSelectForMultipleColumnsOfASingleComponent()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u.username, u.name FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'SELECT u.username, u.name FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
@ -47,7 +50,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSelectWithCollectionAssociationJoin()
|
public function testSupportsSelectWithCollectionAssociationJoin()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u, p FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.phonenumbers p',
|
'SELECT u, p FROM Doctrine\Tests\Models\CMS\CmsUser u JOIN u.phonenumbers p',
|
||||||
@ -55,7 +58,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSelectWithSingleValuedAssociationJoin()
|
public function testSupportsSelectWithSingleValuedAssociationJoin()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u, a FROM Doctrine\Tests\Models\Forum\ForumUser u JOIN u.avatar a',
|
'SELECT u, a FROM Doctrine\Tests\Models\Forum\ForumUser u JOIN u.avatar a',
|
||||||
@ -63,7 +66,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSelectDistinctIsSupported()
|
public function testSupportsSelectDistinct()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT DISTINCT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'SELECT DISTINCT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
@ -71,7 +74,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAggregateFunctionInSelect()
|
public function testSupportsAggregateFunctionInSelectedFields()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT COUNT(u.id) FROM Doctrine\Tests\Models\CMS\CmsUser u GROUP BY u.id',
|
'SELECT COUNT(u.id) FROM Doctrine\Tests\Models\CMS\CmsUser u GROUP BY u.id',
|
||||||
@ -79,7 +82,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWhereClauseInSelectWithPositionalParameter()
|
public function testSupportsWhereClauseWithPositionalParameter()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'select u from Doctrine\Tests\Models\Forum\ForumUser u where u.id = ?1',
|
'select u from Doctrine\Tests\Models\Forum\ForumUser u where u.id = ?1',
|
||||||
@ -87,7 +90,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWhereClauseInSelectWithNamedParameter()
|
public function testSupportsWhereClauseWithNamedParameter()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'select u from Doctrine\Tests\Models\Forum\ForumUser u where u.username = :name',
|
'select u from Doctrine\Tests\Models\Forum\ForumUser u where u.username = :name',
|
||||||
@ -95,7 +98,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWhereANDClauseInSelectWithNamedParameter()
|
public function testSupportsWhereAndClauseWithNamedParameters()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'select u from Doctrine\Tests\Models\Forum\ForumUser u where u.username = :name and u.username = :name2',
|
'select u from Doctrine\Tests\Models\Forum\ForumUser u where u.username = :name and u.username = :name2',
|
||||||
@ -103,7 +106,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCombinedWhereClauseInSelectWithNamedParameter()
|
public function testSupportsCombinedWhereClauseWithNamedParameter()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'select u from Doctrine\Tests\Models\Forum\ForumUser u where (u.username = :name OR u.username = :name2) AND u.id = :id',
|
'select u from Doctrine\Tests\Models\Forum\ForumUser u where (u.username = :name OR u.username = :name2) AND u.id = :id',
|
||||||
@ -111,7 +114,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testAggregateFunctionWithDistinctInSelect()
|
public function testSupportsAggregateFunctionInASelectDistinct()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT COUNT(DISTINCT u.name) FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
'SELECT COUNT(DISTINCT u.name) FROM Doctrine\Tests\Models\CMS\CmsUser u',
|
||||||
@ -120,7 +123,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ticket #668
|
// Ticket #668
|
||||||
public function testKeywordUsageInStringParam()
|
public function testSupportsASqlKeywordInAStringLiteralParam()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name LIKE '%foo OR bar%'",
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.name LIKE '%foo OR bar%'",
|
||||||
@ -128,7 +131,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testArithmeticExpressionsSupportedInWherePart()
|
public function testSupportsArithmeticExpressionsInWherePart()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE ((u.id + 5000) * u.id + 3) < 10000000',
|
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE ((u.id + 5000) * u.id + 3) < 10000000',
|
||||||
@ -136,7 +139,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testPlainJoinWithoutClause()
|
public function testSupportsPlainJoinWithoutClause()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u.id, a.id from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a',
|
'SELECT u.id, a.id from Doctrine\Tests\Models\CMS\CmsUser u LEFT JOIN u.articles a',
|
||||||
@ -148,7 +151,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testDeepJoin()
|
public function testSupportsMultipleJoins()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u.id, a.id, p, c.id from Doctrine\Tests\Models\CMS\CmsUser u JOIN u.articles a JOIN u.phonenumbers p JOIN a.comments c',
|
'SELECT u.id, a.id, p, c.id from Doctrine\Tests\Models\CMS\CmsUser u JOIN u.articles a JOIN u.phonenumbers p JOIN a.comments c',
|
||||||
@ -156,7 +159,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testTrimFunction()
|
public function testSupportsTrimFunction()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM(TRAILING ' ' FROM u.name) = 'someone'",
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM(TRAILING ' ' FROM u.name) = 'someone'",
|
||||||
@ -165,7 +168,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ticket 894
|
// Ticket 894
|
||||||
public function testBetweenDeclarationWithInputParameter()
|
public function testSupportsBetweenClauseWithPositionalParameters()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id BETWEEN ?1 AND ?2",
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id BETWEEN ?1 AND ?2",
|
||||||
@ -173,7 +176,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testFunctionalExpressionsSupportedInWherePart()
|
public function testSupportsFunctionalExpressionsInWherePart()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM(u.name) = 'someone'",
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE TRIM(u.name) = 'someone'",
|
||||||
@ -184,7 +187,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Ticket #973
|
// Ticket #973
|
||||||
public function testSingleInValueWithoutSpace()
|
public function testSupportsSingleValuedInExpressionWithoutSpacesInWherePart()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN(46)",
|
"SELECT u.name FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN(46)",
|
||||||
@ -192,7 +195,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testInExpressionSupportedInWherePart()
|
public function testSupportsMultipleValuedInExpressionInWherePart()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN (1, 2)',
|
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id IN (1, 2)',
|
||||||
@ -200,7 +203,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testNotInExpressionSupportedInWherePart()
|
public function testSupportsNotInExpressionInWherePart()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN (1)',
|
'SELECT u FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE u.id NOT IN (1)',
|
||||||
@ -208,7 +211,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConcatFunction()
|
public function testSupportsConcatFunctionForMysqlAndPostgresql()
|
||||||
{
|
{
|
||||||
$connMock = $this->_em->getConnection();
|
$connMock = $this->_em->getConnection();
|
||||||
$orgPlatform = $connMock->getDatabasePlatform();
|
$orgPlatform = $connMock->getDatabasePlatform();
|
||||||
@ -236,7 +239,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
$connMock->setDatabasePlatform($orgPlatform);
|
$connMock->setDatabasePlatform($orgPlatform);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testExistsExpressionInWhereWithCorrelatedSubquery()
|
public function testSupportsExistsExpressionInWherePartWithCorrelatedSubquery()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE EXISTS (SELECT p.phonenumber FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.phonenumber = u.id)',
|
'SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE EXISTS (SELECT p.phonenumber FROM Doctrine\Tests\Models\CMS\CmsPhonenumber p WHERE p.phonenumber = u.id)',
|
||||||
@ -244,7 +247,7 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testMemberOfExpression()
|
public function testSupportsMemberOfExpression()
|
||||||
{
|
{
|
||||||
// "Get all users who have $phone as a phonenumber." (*cough* doesnt really make sense...)
|
// "Get all users who have $phone as a phonenumber." (*cough* doesnt really make sense...)
|
||||||
$q1 = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.phonenumbers');
|
$q1 = $this->_em->createQuery('SELECT u.id FROM Doctrine\Tests\Models\CMS\CmsUser u WHERE :param MEMBER OF u.phonenumbers');
|
||||||
@ -281,19 +284,19 @@ class SelectSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCurrentDateFunction()
|
public function testSupportsCurrentDateFunction()
|
||||||
{
|
{
|
||||||
$q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_date()');
|
$q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_date()');
|
||||||
$this->assertEquals('SELECT d0_.id AS id0 FROM date_time_model d0_ WHERE d0_.datetime > CURRENT_DATE', $q->getSql());
|
$this->assertEquals('SELECT d0_.id AS id0 FROM date_time_model d0_ WHERE d0_.datetime > CURRENT_DATE', $q->getSql());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCurrentTimeFunction()
|
public function testSupportsCurrentTimeFunction()
|
||||||
{
|
{
|
||||||
$q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.time > current_time()');
|
$q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.time > current_time()');
|
||||||
$this->assertEquals('SELECT d0_.id AS id0 FROM date_time_model d0_ WHERE d0_.time > CURRENT_TIME', $q->getSql());
|
$this->assertEquals('SELECT d0_.id AS id0 FROM date_time_model d0_ WHERE d0_.time > CURRENT_TIME', $q->getSql());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCurrentTimestampFunction()
|
public function testSupportsCurrentTimestampFunction()
|
||||||
{
|
{
|
||||||
$q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_timestamp()');
|
$q = $this->_em->createQuery('SELECT d.id FROM Doctrine\Tests\Models\Generic\DateTimeModel d WHERE d.datetime > current_timestamp()');
|
||||||
$this->assertEquals('SELECT d0_.id AS id0 FROM date_time_model d0_ WHERE d0_.datetime > CURRENT_TIMESTAMP', $q->getSql());
|
$this->assertEquals('SELECT d0_.id AS id0 FROM date_time_model d0_ WHERE d0_.datetime > CURRENT_TIMESTAMP', $q->getSql());
|
||||||
|
@ -56,16 +56,19 @@ class UpdateSqlGenerationTest extends \Doctrine\Tests\OrmTestCase
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testWithoutWhere()
|
public function testSupportsQueriesWithoutWhere()
|
||||||
{
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1',
|
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1',
|
||||||
'UPDATE cms_users SET name = ?'
|
'UPDATE cms_users SET name = ?'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testSupportsMultipleFieldsWithoutWhere()
|
||||||
|
{
|
||||||
$this->assertSqlGeneration(
|
$this->assertSqlGeneration(
|
||||||
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1, u.username = ?2',
|
'UPDATE Doctrine\Tests\Models\CMS\CmsUser u SET u.name = ?1, u.username = ?2',
|
||||||
'UPDATE cms_users SET name = ?, username = ?'
|
'UPDATE cms_users SET name = ?, username = ?'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user