From 747f9e3d1362d4919acfac0b780968e1d26c99e0 Mon Sep 17 00:00:00 2001 From: Koji Tanaka Date: Thu, 16 Feb 2023 00:36:53 +0900 Subject: [PATCH] test: Fixed improved return value of mocked PDO class exec() method. Return value of PDO::exec() is the number of rows affected, which is 0 for any of these method calls. --- lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php index bb10756ed..802cefc08 100644 --- a/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php +++ b/lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php @@ -1425,10 +1425,10 @@ class DboSourceTest extends CakeTestCase { $db->nestedSupport = true; $conn->expects($this->at(0))->method('beginTransaction')->will($this->returnValue(true)); - $conn->expects($this->at(1))->method('exec')->with($this->equalTo('SAVEPOINT LEVEL1'))->will($this->returnValue(true)); - $conn->expects($this->at(2))->method('exec')->with($this->equalTo('RELEASE SAVEPOINT LEVEL1'))->will($this->returnValue(true)); - $conn->expects($this->at(3))->method('exec')->with($this->equalTo('SAVEPOINT LEVEL1'))->will($this->returnValue(true)); - $conn->expects($this->at(4))->method('exec')->with($this->equalTo('ROLLBACK TO SAVEPOINT LEVEL1'))->will($this->returnValue(true)); + $conn->expects($this->at(1))->method('exec')->with($this->equalTo('SAVEPOINT LEVEL1'))->will($this->returnValue(0)); + $conn->expects($this->at(2))->method('exec')->with($this->equalTo('RELEASE SAVEPOINT LEVEL1'))->will($this->returnValue(0)); + $conn->expects($this->at(3))->method('exec')->with($this->equalTo('SAVEPOINT LEVEL1'))->will($this->returnValue(0)); + $conn->expects($this->at(4))->method('exec')->with($this->equalTo('ROLLBACK TO SAVEPOINT LEVEL1'))->will($this->returnValue(0)); $conn->expects($this->at(5))->method('commit')->will($this->returnValue(true)); $this->_runTransactions($db);