public function ConnectionTest::testRethrowPDOException in Drupal driver for SQL Server and SQL Azure 4.1.x
Same name and namespace in other branches
- 4.2.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testRethrowPDOException()
- 3.1.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testRethrowPDOException()
- 4.0.x tests/src/Kernel/ConnectionTest.php \Drupal\Tests\sqlsrv\Kernel\ConnectionTest::testRethrowPDOException()
Test PDOExceptions are rethrown.
File
- tests/src/ Kernel/ ConnectionTest.php, line 74 
Class
- ConnectionTest
- Tests of the sqlsrv database system.
Namespace
Drupal\Tests\sqlsrv\KernelCode
public function testRethrowPDOException() {
  $connection_array = [
    'driver' => 'sqlsrv',
    'database' => 'mydrupalsite',
    'username' => 'sa',
    'password' => 'Password12!',
    'host' => '10.0.0.42',
    'schema' => 'dbo',
    'cache_schema' => 'true',
  ];
  $this
    ->expectException(\PDOException::class);
  $this
    ->expectExceptionCode('HYT00');
  // Generate an exception
  $this->connection
    ->open($connection_array);
}