Commit a64191dd authored by catch's avatar catch
Browse files

Issue #3241306 by alexpott, mondrake:...

Issue #3241306 by alexpott, mondrake: core/tests/Drupal/Tests/Core/Database/ConnectionTest.php fails on PHP 8.1
parent 789895fd
......@@ -4,10 +4,8 @@
use Composer\Autoload\ClassLoader;
use Drupal\Core\Database\Statement;
use Drupal\Core\Database\StatementWrapper;
use Drupal\Tests\Core\Database\Stub\StubConnection;
use Drupal\Tests\Core\Database\Stub\StubPDO;
use Drupal\Tests\Core\Database\Stub\Driver;
use Drupal\Tests\UnitTestCase;
/**
......@@ -667,21 +665,12 @@ public function testStatementDeprecation() {
* @dataProvider provideQueriesToTrim
*/
public function testQueryTrim($expected, $query, $options) {
$mock_pdo = $this->getMockBuilder(StubPdo::class)
->onlyMethods(['prepare'])
->getMock();
$mock_statement = $this->getMockBuilder(StatementWrapper::class)
->disableOriginalConstructor()
->getMock();
// Ensure that PDO::prepare() is called only once, and with the
// correctly trimmed query string.
$mock_pdo->expects($this->once())
->method('prepare')
->with($expected)
->willReturn($mock_statement);
$mock_pdo = $this->getMockBuilder(StubPdo::class)->getMock();
$connection = new StubConnection($mock_pdo, []);
$connection->query($query, [], $options);
$preprocess_method = new \ReflectionMethod($connection, 'preprocessStatement');
$preprocess_method->setAccessible(TRUE);
$this->assertSame($expected, $preprocess_method->invoke($connection, $query, $options));
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment