Skip to content

Commit

Permalink
#1188 - assertCount instead of assertEquals
Browse files Browse the repository at this point in the history
  • Loading branch information
Ocramius committed Nov 27, 2014
1 parent 4254723 commit 6475253
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions tests/Doctrine/Tests/ORM/Functional/PaginationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@ public function testQueryWalkerIsKept()

public function testCountQueryStripsParametersInSelect()
{
/** @var $query Query */
$query = $this->_em->createQuery(
'SELECT u, (CASE WHEN u.id < :vipMaxId THEN 1 ELSE 0 END) AS hidden promotedFirst
FROM Doctrine\\Tests\\Models\\CMS\\CmsUser u
Expand All @@ -170,20 +169,17 @@ public function testCountQueryStripsParametersInSelect()

$getCountQuery->setAccessible(true);

$countQuery = $getCountQuery->invoke($paginator);

$this->assertEquals(2, count($countQuery->getParameters()));
$this->assertEquals(3, $paginator->count());
$this->assertCount(2, $getCountQuery->invoke($paginator)->getParameters());
$this->assertCount(3, $paginator);

$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, 'Doctrine\ORM\Query\SqlWalker');

$paginator = new Paginator($query);

$countQuery = $getCountQuery->invoke($paginator);

//if select part of query is replaced with count(...) paginator should remove parameters from query object not used in new query.
$this->assertEquals(1, count($countQuery->getParameters()));
$this->assertEquals(3, $paginator->count());
// if select part of query is replaced with count(...) paginator should remove
// parameters from query object not used in new query.
$this->assertCount(1, $getCountQuery->invoke($paginator)->getParameters());
$this->assertCount(3, $paginator);
}

public function populate()
Expand Down

0 comments on commit 6475253

Please sign in to comment.