Code Duplication    Length = 17-20 lines in 2 locations

tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfAbstractTest.php 1 location

@@ 21-37 (lines=17) @@
18
            ]);
19
        }
20
21
        public function testInstanceOf()
22
        {
23
            $this->loadData();
24
25
            $dql = 'SELECT p FROM Doctrine\Tests\ORM\Functional\InstanceOfAbstractTest\Person p
26
                    WHERE p INSTANCE OF Doctrine\Tests\ORM\Functional\InstanceOfAbstractTest\Person';
27
            $query = $this->_em->createQuery($dql);
28
            $result = $query->getResult();
29
30
            $this->assertCount(1, $result);
31
32
            foreach ($result as $r) {
33
                $this->assertInstanceOf(Person::class, $r);
34
                $this->assertInstanceOf(Employee::class, $r);
35
                $this->assertSame('bar', $r->getName());
36
            }
37
        }
38
39
        private function loadData()
40
        {

tests/Doctrine/Tests/ORM/Functional/Ticket/Ticket4646InstanceOfTest.php 1 location

@@ 21-40 (lines=20) @@
18
            ]);
19
        }
20
21
        public function testInstanceOf()
22
        {
23
            $this->loadData();
24
25
            $dql = 'SELECT p FROM Doctrine\Tests\ORM\Functional\InstanceOfTest\Person p
26
                    WHERE p INSTANCE OF Doctrine\Tests\ORM\Functional\InstanceOfTest\Person';
27
            $query = $this->_em->createQuery($dql);
28
            $result = $query->getResult();
29
30
            $this->assertCount(2, $result);
31
32
            foreach ($result as $r) {
33
                $this->assertInstanceOf(Person::class, $r);
34
                if ($r instanceof Employee) {
35
                    $this->assertEquals('bar', $r->getName());
36
                } else {
37
                    $this->assertEquals('foo', $r->getName());
38
                }
39
            }
40
        }
41
42
        private function loadData()
43
        {