Skip to content

Commit c9c7d67

Browse files
committed
Fix PostgresQL test (a stab in the dark)
1 parent 2d4c8b7 commit c9c7d67

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/Doctrine/Tests/ORM/Functional/Ticket/GH5998Test.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,15 @@ private function classTests($className): void
4848
$this->_em->persist($child->rel);
4949
$this->_em->flush();
5050
$this->_em->clear();
51+
$id = $child->id;
5152

5253
// Test find by rel
5354
$child = $this->_em->getRepository($className)->findOneBy(['rel' => $child->rel]);
5455
self::assertNotNull($child);
5556
$this->_em->clear();
5657

5758
// Test query by id with fetch join
58-
$child = $this->_em->createQuery('SELECT t, r FROM ' . $className . ' t JOIN t.rel r WHERE t.id = 1')->getOneOrNullResult();
59+
$child = $this->_em->createQuery('SELECT t, r FROM ' . $className . ' t JOIN t.rel r WHERE t.id = ?0')->setParameter(0, $id)->getOneOrNullResult();
5960
self::assertNotNull($child);
6061

6162
// Test lock and update
@@ -65,14 +66,15 @@ private function classTests($className): void
6566
$child->status = 0;
6667
});
6768
$this->_em->clear();
68-
$child = $this->_em->getRepository($className)->find(1);
69+
$child = $this->_em->getRepository($className)->find($id);
70+
self::assertNotNull($child);
6971
self::assertEquals($child->firstName, 'Bob');
7072
self::assertEquals($child->status, 0);
7173

7274
// Test delete
7375
$this->_em->remove($child);
7476
$this->_em->flush();
75-
$child = $this->_em->getRepository($className)->find(1);
77+
$child = $this->_em->getRepository($className)->find($id);
7678
self::assertNull($child);
7779
}
7880
}

0 commit comments

Comments
 (0)