Skip to content

Commit

Permalink
#9974 extended test with PDO::ATTR_DEFAULT_FETCH_MODE for future impl…
Browse files Browse the repository at this point in the history
…ementation
  • Loading branch information
thbley committed Jul 27, 2023
1 parent d600705 commit ee50525
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tests/MethodCallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -507,10 +507,13 @@ class B extends A {}
$db = new PDO("sqlite::memory:");
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$db->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_ASSOC);
$stmt = $db->prepare("select \"a\" as a");
$stmt->setFetchMode(PDO::FETCH_CLASS, A::class);
$stmt2 = $db->prepare("select \"a\" as a");
$stmt2->setFetchMode(PDO::FETCH_ASSOC);
$stmt3 = $db->prepare("select \"a\" as a");
$stmt3->setFetchMode(PDO::ATTR_DEFAULT_FETCH_MODE);
$stmt->execute();
$stmt2->execute();
/** @psalm-suppress MixedAssignment */
Expand All @@ -525,7 +528,9 @@ class B extends A {}
$h = $stmt2->fetch();
$i = $stmt2->fetchAll();
$j = $stmt2->fetch(PDO::FETCH_BOTH);
$k = $stmt2->fetchAll(PDO::FETCH_BOTH);',
$k = $stmt2->fetchAll(PDO::FETCH_BOTH);
/** @psalm-suppress MixedAssignment */
$l = $stmt3->fetch();',
'assertions' => [
'$a' => 'mixed',
'$b' => 'array<array-key, mixed>|false',
Expand All @@ -538,6 +543,7 @@ class B extends A {}
'$i' => 'array<array-key, mixed>|false',
'$j' => 'array<array-key, null|scalar>|false',
'$k' => 'list<array<array-key, null|scalar>>',
'$l' => 'mixed',
],
],
'datePeriodConstructor' => [
Expand Down

0 comments on commit ee50525

Please sign in to comment.