Failed Conditions
Pull Request — 2.7 (#8107)
by
unknown
06:45
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\ORM\Annotation as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Annotation was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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(
0 ignored issues
show
Bug introduced by
The property schemaTool does not exist on Doctrine\Tests\ORM\Functional\Ticket\GH8106Test. Did you mean _schemaTool?
Loading history...
23
            [
24
                $this->em->getClassMetadata(GH8106User::class),
0 ignored issues
show
Bug Best Practice introduced by
The property em does not exist on Doctrine\Tests\ORM\Functional\Ticket\GH8106Test. Did you maybe forget to declare it?
Loading history...
25
            ]
26
        );
27
    }
28
29
    public function testIssue() : void
30
    {
31
        $user = new GH8106User();
32
        $this->em->persist($user);
0 ignored issues
show
Bug Best Practice introduced by
The property em does not exist on Doctrine\Tests\ORM\Functional\Ticket\GH8106Test. Did you maybe forget to declare it?
Loading history...
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