Failed Conditions
Pull Request — master (#6705)
by Michael
14:32
created

GH6699Test   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 0
loc 27
rs 10
c 1
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 5 1
A testMixedParametersWithZeroNumber() 0 18 1
1
<?php
2
3
namespace Doctrine\Tests\ORM\Functional\Ticket;
4
5
use Doctrine\Tests\Models\CMS\CmsUser;
6
use Doctrine\Tests\OrmFunctionalTestCase;
7
8
/**
9
 * @group #6699
10
 */
11
class GH6699Test extends OrmFunctionalTestCase
12
{
13
    protected function setUp()
14
    {
15
        $this->useModelSet('cms');
16
        parent::setUp();
17
    }
18
19
    public function testMixedParametersWithZeroNumber()
20
    {
21
        $qb = $this->_em->createQueryBuilder()
22
            ->select('u')
23
            ->from(CmsUser::class, 'u')
24
            ->andWhere('u.username = :username')
25
            ->andWhere('u.id = ?0');
26
        $query = $qb->getQuery();
27
28
        $query->setParameter('username', 'bar');
29
        $query->setParameter(0, 0);
30
31
        $query->execute();
32
33
        $this->assertSame(2, $query->getParameters()->count());
34
        $this->assertSame(0, $query->getParameter(0)->getValue());
35
        $this->assertSame('bar', $query->getParameter('username')->getValue());
36
    }
37
}
38
39