DatabaseExceptionWrapperTest.php

Namespace

Drupal\Tests\sqlite\Kernel\sqlite

File

core/modules/sqlite/tests/src/Kernel/sqlite/DatabaseExceptionWrapperTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\sqlite\Kernel\sqlite;

use Drupal\KernelTests\Core\Database\DriverSpecificKernelTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;

/**
 * Tests exceptions thrown by queries.
 */
class DatabaseExceptionWrapperTest extends DriverSpecificKernelTestBase {
  
  /**
   * Tests Connection::prepareStatement exception on execution.
   */
  public function testPrepareStatementFailOnExecution() : void {
    $this->expectException(\PDOException::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.