File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed
tests/Tests/ORM/Functional/Ticket Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Doctrine \Tests \ORM \Functional \Ticket ;
6
+
7
+ use Doctrine \ORM \Tools \Pagination \Paginator ;
8
+ use Doctrine \Tests \Models \CMS \CmsArticle ;
9
+ use Doctrine \Tests \OrmFunctionalTestCase ;
10
+
11
+ final class GH12183Test extends OrmFunctionalTestCase
12
+ {
13
+ protected function setUp (): void
14
+ {
15
+ $ this ->useModelSet ('cms ' );
16
+
17
+ parent ::setUp ();
18
+
19
+ $ article = new CmsArticle ();
20
+
21
+ $ article ->topic = 'Loomings ' ;
22
+ $ article ->text = 'Call me Ishmael. ' ;
23
+
24
+ $ this ->_em ->persist ($ article );
25
+ $ this ->_em ->flush ();
26
+ $ this ->_em ->clear ();
27
+ }
28
+
29
+ public function testPaginatorCountWithOutputWalkerAfterQueryHasBeenExecuted (): void
30
+ {
31
+ $ query = $ this ->_em ->createQuery ('SELECT a FROM Doctrine\Tests\Models\CMS\CmsArticle a ' );
32
+
33
+ // Paginator::count is right when the query has not yet been executed
34
+ $ paginator = new Paginator ($ query );
35
+ $ paginator ->setUseOutputWalkers (false );
36
+ self ::assertSame (1 , $ paginator ->count ());
37
+
38
+ // Execute the query
39
+ $ result = $ query ->getResult ();
40
+ self ::assertCount (1 , $ result );
41
+
42
+ $ paginator = new Paginator ($ query );
43
+ $ paginator ->setUseOutputWalkers (false );
44
+ self ::assertSame (1 , $ paginator ->count ());
45
+ }
46
+ }
You can’t perform that action at this time.
0 commit comments