DatabaseExceptionWrapperTest.php
Same filename in this branch
- 11.x core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php
- 11.x core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php
- 11.x core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php
- 11.x core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php
Same filename and directory in other branches
- 9 core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php
- 9 core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php
- 9 core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php
- 9 core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php
- 8.9.x core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php
- 10 core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php
- 10 core/modules/mysql/tests/src/Kernel/mysql/DatabaseExceptionWrapperTest.php
- 10 core/modules/pgsql/tests/src/Kernel/pgsql/DatabaseExceptionWrapperTest.php
- 10 core/tests/Drupal/KernelTests/Core/Database/DatabaseExceptionWrapperTest.php
Namespace
Drupal\Tests\mysqli\Kernel\mysqliFile
-
core/
modules/ mysqli/ tests/ src/ Kernel/ mysqli/ DatabaseExceptionWrapperTest.php
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\mysqli\Kernel\mysqli;
use Drupal\Tests\mysql\Kernel\mysql\DatabaseExceptionWrapperTest as BaseMySqlTest;
use PHPUnit\Framework\Attributes\Group;
/**
* Tests exceptions thrown by queries.
*/
class DatabaseExceptionWrapperTest extends BaseMySqlTest {
/**
* Tests Connection::prepareStatement exceptions on preparation.
*
* Core database drivers use PDO emulated statements or the StatementPrefetch
* class, which defer the statement check to the moment of the execution. In
* order to test a failure at preparation time, we have to force the
* connection not to emulate statement preparation. Still, this is only valid
* for the MySql driver.
*/
public function testPrepareStatementFailOnPreparation() : void {
$this->markTestSkipped('mysqli is not a pdo driver.');
}
/**
* Tests Connection::prepareStatement exception on execution.
*/
public function testPrepareStatementFailOnExecution() : void {
$this->expectException(\mysqli_sql_exception::class);
$stmt = $this->connection
->prepareStatement('bananas', []);
$stmt->execute();
}
}
Classes
Title | Deprecated | Summary |
---|---|---|
DatabaseExceptionWrapperTest | Tests exceptions thrown by queries. |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.