|
11 | 11 |
|
12 | 12 | namespace Symfony\Polyfill\Tests\Php84; |
13 | 13 |
|
| 14 | +use PDOException; |
14 | 15 | use PHPUnit\Framework\TestCase; |
15 | 16 |
|
16 | 17 | class PdoTest extends TestCase |
17 | 18 | { |
| 19 | + /** |
| 20 | + * @requires extension pdo_dblib |
| 21 | + * @requires extension pdo_sqlite |
| 22 | + */ |
| 23 | + public function testDblibConstructor() |
| 24 | + { |
| 25 | + $this->expectException(PDOException::class); |
| 26 | + $this->expectExceptionMessage("Pdo\Dblib::__construct() cannot be used for connecting to the \"sqlite\" driver"); |
| 27 | + new \Pdo\Dblib("sqlite:"); |
| 28 | + } |
| 29 | + |
| 30 | + /** |
| 31 | + * @requires extension pdo_firebird |
| 32 | + * @requires extension pdo_sqlite |
| 33 | + */ |
| 34 | + public function testFirebirdConstructor() |
| 35 | + { |
| 36 | + $this->expectException(PDOException::class); |
| 37 | + $this->expectExceptionMessage("Pdo\Firebird::__construct() cannot be used for connecting to the \"sqlite\" driver"); |
| 38 | + new \Pdo\Dblib("sqlite:"); |
| 39 | + } |
| 40 | + |
| 41 | + /** |
| 42 | + * @requires extension pdo_mysql |
| 43 | + * @requires extension pdo_sqlite |
| 44 | + */ |
| 45 | + public function testMysqlConstructor() |
| 46 | + { |
| 47 | + $this->expectException(PDOException::class); |
| 48 | + $this->expectExceptionMessage("Pdo\Mysql::__construct() cannot be used for connecting to the \"sqlite\" driver"); |
| 49 | + new \Pdo\Mysql("sqlite:"); |
| 50 | + } |
| 51 | + |
| 52 | + /** |
| 53 | + * @requires extension pdo_odbc |
| 54 | + * @requires extension pdo_sqlite |
| 55 | + */ |
| 56 | + public function testOdbcConstructor() |
| 57 | + { |
| 58 | + $this->expectException(PDOException::class); |
| 59 | + $this->expectExceptionMessage("Pdo\Odbc::__construct() cannot be used for connecting to the \"sqlite\" driver"); |
| 60 | + new \Pdo\Odbc("sqlite:"); |
| 61 | + } |
| 62 | + |
| 63 | + /** |
| 64 | + * @requires extension pdo_pgsql |
| 65 | + * @requires extension pdo_sqlite |
| 66 | + */ |
| 67 | + public function testPgsqlConstructor() |
| 68 | + { |
| 69 | + $this->expectException(PDOException::class); |
| 70 | + $this->expectExceptionMessage("Pdo\Pgsql::__construct() cannot be used for connecting to the \"sqlite\" driver"); |
| 71 | + new \Pdo\Pgsql("sqlite:"); |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * @requires extension pdo_sqlite |
| 76 | + */ |
| 77 | + public function testSqliteConstructor() |
| 78 | + { |
| 79 | + $sqlite = new \Pdo\Sqlite("sqlite:"); |
| 80 | + $this->assertInstanceOf(\Pdo\Sqlite::class, $sqlite); |
| 81 | + } |
| 82 | + |
18 | 83 | /** |
19 | 84 | * @requires extension pdo_dblib |
20 | 85 | */ |
|
0 commit comments