Skip to content

Commit 8724dd7

Browse files
staabmclxmstaab
andauthored
moved more mysql specific tests (#350)
* moved mysql specific tests * f * Update pdo-mysql.php * Update pdo-mysql.php Co-authored-by: Markus Staab <[email protected]>
1 parent fa7dd72 commit 8724dd7

File tree

4 files changed

+11
-6
lines changed

4 files changed

+11
-6
lines changed

tests/default/DbaInferenceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function dataFileAsserts(): iterable
5050
yield from $this->gatherAssertTypes(__DIR__.'/data/runMysqlQuery.php');
5151

5252
// XXX cases which are not yet supported by the PdoQueryReflector
53-
if ('pdo' !== getenv('DBA_REFLECTOR')) {
53+
if ('pdo' !== getenv('DBA_REFLECTOR') && 'pdo-pgsql' !== getenv('DBA_REFLECTOR')) {
5454
yield from $this->gatherAssertTypes(__DIR__.'/data/query-alias.php');
5555
}
5656

tests/default/data/pdo-mysql.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function aggregateFunctions(PDO $pdo)
2828
assertType('PDOStatement<array{MAX(adaid): int<-32768, 32767>|null, MIN(adaid): int<-32768, 32767>|null, COUNT(adaid): int, AVG(adaid): float|null}>', $stmt);
2929
}
3030

31-
public function placeholderInData(PDO $pdo)
31+
public function placeholderInDataPrepared(PDO $pdo)
3232
{
3333
// double quotes within the query
3434
$query = 'SELECT adaid FROM ada WHERE email LIKE ":gesperrt%"';
@@ -44,4 +44,12 @@ public function placeholderInData(PDO $pdo)
4444
$stmt->execute();
4545
assertType('PDOStatement<array{adaid: int<-32768, 32767>, 0: int<-32768, 32767>}>', $stmt);
4646
}
47+
48+
public function placeholderInDataQuery(PDO $pdo)
49+
{
50+
// double quotes within the query
51+
$query = 'SELECT adaid FROM ada WHERE email LIKE ":gesperrt%"';
52+
$stmt = $pdo->query($query, PDO::FETCH_ASSOC);
53+
assertType('PDOStatement<array{adaid: int<-32768, 32767>}>', $stmt);
54+
}
4755
}

tests/default/data/pdo.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,6 @@ public function placeholderInData(PDO $pdo)
153153
$stmt = $pdo->query($query, PDO::FETCH_ASSOC);
154154
assertType('PDOStatement<array{adaid: int<-32768, 32767>}>', $stmt);
155155

156-
$query = 'SELECT adaid FROM ada WHERE email LIKE ":gesperrt%"';
157-
$stmt = $pdo->query($query, PDO::FETCH_ASSOC);
158-
assertType('PDOStatement<array{adaid: int<-32768, 32767>}>', $stmt);
159-
160156
$query = "SELECT adaid FROM ada WHERE email LIKE ':gesperrt%'";
161157
$stmt = $pdo->query($query, PDO::FETCH_ASSOC);
162158
assertType('PDOStatement<array{adaid: int<-32768, 32767>}>', $stmt);

tests/default/data/query-alias.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
class Foo
99
{
10+
// TODO pgsql: doesn't resolve null?
1011
public function leftJoinQuery(PDO $pdo)
1112
{
1213
$query = 'SELECT a.email, b.adaid FROM ada a LEFT JOIN ada b ON a.adaid=b.adaid';

0 commit comments

Comments
 (0)