Passed
Pull Request — 2.7 (#8107)
by
unknown
06:48
created

GH8106Test::testIssue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 13
nc 1
nop 0
dl 0
loc 18
rs 9.8333
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\Tests\ORM\Functional\Ticket;
6
7
use Doctrine\Tests\OrmFunctionalTestCase;
8
9
/**
10
 * @group GH-8106
11
 */
12
class GH8106Test extends OrmFunctionalTestCase
13
{
14
    /**
15
     * {@inheritDoc}
16
     */
17
    protected function setUp() : void
18
    {
19
        parent::setUp();
20
21
        $this->_schemaTool->createSchema(
22
            [
23
                $this->_em->getClassMetadata(GH8106User::class),
24
            ]
25
        );
26
    }
27
28
    public function testIssue() : void
29
    {
30
        $user = new GH8106User();
31
        $this->_em->persist($user);
32
        $this->_em->flush();
33
        $this->_em->clear();
34
35
        $qb = $this->_em->createQueryBuilder();
36
        $qb
37
            ->select('u')
38
            ->from(GH8106User::class, 'u')
39
            ->where('u.id = :id')
40
            ->setParameter(':id', 1)
41
            ->setParameter(':id', 1);
42
43
        $result = $qb->getQuery()->getResult(); // should not throw QueryException
44
45
        self::assertCount(1, $result);
46
    }
47
}
48
49
/** @Entity */
50
class GH8106User
51
{
52
    /** @Id @Column(type="integer") @GeneratedValue */
53
    public $id;
54
}
55