Passed
Pull Request — 2.6 (#7803)
by
unknown
07:39
created

GH7805Test::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Doctrine\Tests\ORM\Functional\Ticket;
4
5
use Doctrine\ORM\Tools\Pagination\Paginator;
6
use Doctrine\Tests\Models\CMS\CmsArticle;
7
use Doctrine\Tests\OrmFunctionalTestCase;
8
9
class GH7805Test extends OrmFunctionalTestCase
10
{
11
    protected function setUp()
12
    {
13
        $this->useModelSet('cms');
14
        parent::setUp();
15
    }
16
17
    public function testPaginationWithSimpleArithmetic()
18
    {
19
        $article = new CmsArticle;
20
        $article->topic = 'Test SimpleArithmetic ORDER BY';
21
        $article->text = 'This test fails on MySQL.';
22
        $article->version = 1;
23
24
        $this->_em->persist($article);
25
        $this->_em->flush();
26
27
        $query = $this->_em->createQuery('SELECT a FROM Doctrine\Tests\Models\CMS\CmsArticle a ORDER BY a.version + 0 ASC');
28
        $query->setFirstResult(0);
29
        $query->setMaxResults(1);
30
31
        $paginator = new Paginator($query, true);
32
        $paginator->setUseOutputWalkers(false);
33
        $this->assertEquals(1, count(iterator_to_array($paginator)));
34
    }
35
}
36