You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (!preg_match('/^([a-z0-9]+):/', $dsn, $matches)) {
52
+
thrownewPDOException('PDO::connect(): Argument #1 ($dsn) must be a valid data source name.');
53
+
}
54
+
55
+
if (!in_array($matches[1], PDO::getAvailableDrivers(), true)) {
56
+
thrownewPDOException('Count not find driver');
57
+
}
58
+
59
+
if ($matches[1] !== 'mysql') {
60
+
thrownewPDOException(sprintf('PdoMysql::connect() cannot be called when connecting to the "%s" driver, either %s::connect() or PDO::connect() must be called instead.',
$this->assertSame(constant('PDO::' . $constant), constant(PdoMysql::class . '::' . $mysqlConstant), 'Check if value and type PDO::' . $constant . ' === ' . PdoMysql::class . '::' . $mysqlConstant);
28
28
}
29
+
30
+
publicfunctiontestThrowsOnDifferentDsns(): void {
31
+
$this->expectException(PDOException::class);
32
+
$this->expectExceptionMessage('could not find driver');
33
+
PdoMysql::connect('foobar:test');
34
+
}
35
+
36
+
publicfunctiontestThrowsOnUnknownDsns(): void {
37
+
if (!in_array('sqlite', PDO::getAvailableDrivers(), true)) {
38
+
$this->markTestSkipped('Sqlite driver not available');
39
+
}
40
+
41
+
$this->expectException(PDOException::class);
42
+
$this->expectExceptionMessage('PdoMysql::connect() cannot be called when connecting to the "sqlite" driver, either PdoSqlite::connect() or PDO::connect() must be called instead');
0 commit comments