Completed
Pull Request — master (#8107)
by
unknown
63:20
created

GH8106Test::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

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