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.
This commit is contained in:
Koji Tanaka 2023-02-16 00:36:53 +09:00 committed by Kamil Wylegala
parent 7df7fefca4
commit 747f9e3d13

View file

@ -1425,10 +1425,10 @@ class DboSourceTest extends CakeTestCase {
$db->nestedSupport = true; $db->nestedSupport = true;
$conn->expects($this->at(0))->method('beginTransaction')->will($this->returnValue(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(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(true)); $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(true)); $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(true)); $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)); $conn->expects($this->at(5))->method('commit')->will($this->returnValue(true));
$this->_runTransactions($db); $this->_runTransactions($db);