1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
declare(strict_types=1);
namespace Doctrine\DBAL\Tests\Functional\Driver\SQLSrv;
use Doctrine\DBAL\Driver\Exception;
use Doctrine\DBAL\Driver\SQLSrv\Driver;
use Doctrine\DBAL\Tests\FunctionalTestCase;
/**
* @requires extension sqlsrv
*/
class StatementTest extends FunctionalTestCase
{
protected function setUp(): void
{
parent::setUp();
if ($this->connection->getDriver() instanceof Driver) {
return;
}
self::markTestSkipped('sqlsrv only test');
}
public function testFailureToPrepareResultsInException(): void
{
// use the driver connection directly to avoid having exception wrapped
$stmt = $this->connection->getWrappedConnection()->prepare('');
// it's impossible to prepare the statement without bound variables for SQL Server,
// so the preparation happens before the first execution when variables are already in place
$this->expectException(Exception::class);
$stmt->execute();
}
}