Skip to content

Commit bc49e73

Browse files
committed
Merge pull request #117 from xrash/composite-key-fix
Update the CompositeKeyTest to use a populated schema.
2 parents 095bb01 + d2b31a8 commit bc49e73

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

tests/Test/Pager/Subscriber/Paginate/Doctrine/ORM/CompositeKeyTest.php

+33-2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ function shouldBeHandledByQueryHintByPassingCount()
1717
{
1818
$p = new Paginator;
1919
$em = $this->getMockSqliteEntityManager();
20+
$this->populate($em);
2021

2122
$count = $em
2223
->createQuery('SELECT COUNT(c) FROM Test\Fixture\Entity\Composite c')
@@ -27,15 +28,45 @@ function shouldBeHandledByQueryHintByPassingCount()
2728
->createQuery('SELECT c FROM Test\Fixture\Entity\Composite c')
2829
->setHint('knp_paginator.count', $count)
2930
;
30-
$query->setHint(Query::HINT_CUSTOM_OUTPUT_WALKER, false);
31+
$query->setHint(UsesPaginator::HINT_FETCH_JOIN_COLLECTION, false);
3132
$view = $p->paginate($query, 1, 10, array('wrap-queries' => true));
3233

3334
$items = $view->getItems();
34-
$this->assertEquals(0, count($items));
35+
$this->assertEquals(4, count($items));
3536
}
3637

3738
protected function getUsedEntityFixtures()
3839
{
3940
return array('Test\Fixture\Entity\Composite');
4041
}
42+
43+
private function populate($em)
44+
{
45+
$summer = new Composite;
46+
$summer->setId(1);
47+
$summer->setTitle('summer');
48+
$summer->setUid(100);
49+
50+
$winter = new Composite;
51+
$winter->setId(2);
52+
$winter->setTitle('winter');
53+
$winter->setUid(200);
54+
55+
$autumn = new Composite;
56+
$autumn->setId(3);
57+
$autumn->setTitle('autumn');
58+
$autumn->setUid(300);
59+
60+
$spring = new Composite;
61+
$spring->setId(4);
62+
$spring->setTitle('spring');
63+
$spring->setUid(400);
64+
65+
$em->persist($summer);
66+
$em->persist($winter);
67+
$em->persist($autumn);
68+
$em->persist($spring);
69+
$em->flush();
70+
}
71+
4172
}

0 commit comments

Comments
 (0)