From ba0967c74f1b4f1293f19b73ac62530edfdef2fa Mon Sep 17 00:00:00 2001 From: Matthias Pigulla Date: Sat, 3 Jun 2023 12:30:10 +0200 Subject: [PATCH] Update tests/Doctrine/Tests/ORM/Functional/Ticket/GH10532Test.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Grégoire Paris --- .../ORM/Functional/Ticket/GH10532Test.php | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH10532Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH10532Test.php index b3762b068e4..7a26edfcc20 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH10532Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH10532Test.php @@ -75,22 +75,27 @@ public function testDeletes(): void $con = $this->_em->getConnection(); // The "c" entity - $con->insert('gh10532_x', ['id' => 1, 'discr' => 'C']); - $con->insert('gh10532_c', ['id' => 1]); - $c = $this->_em->find(GH10532C::class, 1); + $con->insert('gh10532_x', ['discr' => 'C']); + $cId = $con->lastInsertId(); + $con->insert('gh10532_c', ['id' => $cId]); + $c = $this->_em->find(GH10532C::class, $cId); // The "a2" entity - $con->insert('gh10532_a', ['id' => 2, 'gh10532x_id' => 1]); - $a2 = $this->_em->find(GH10532A::class, 2); + $con->insert('gh10532_a', ['gh10532x_id' => $cId]); + $a2Id = $con->lastInsertId(); + $a2 = $this->_em->find(GH10532A::class, $a2Id); // The "b" entity - $con->insert('gh10532_x', ['id' => 3, 'discr' => 'B']); - $con->insert('gh10532_b', ['id' => 3, 'gh10532a_id' => 2]); - $b = $this->_em->find(GH10532B::class, 3); + $con->insert('gh10532_x', ['discr' => 'B']); + $bId = $con->lastInsertId(); + $con->insert('gh10532_b', ['id' => $bId, 'gh10532a_id' => $a2Id]); + $b = $this->_em->find(GH10532B::class, $bId); // The "a1" entity - $con->insert('gh10532_a', ['id' => 4, 'gh10532x_id' => 3]); - $a1 = $this->_em->find(GH10532A::class, 4); + $con->insert('gh10532_a', ['gh10532x_id' => $bId]); + $a1Id = $con->lastInsertId(); + $a1 = $this->_em->find(GH10532A::class, $a1Id); + /* * The following would make the deletions happen in an order