Skip to content

Commit 59f0502

Browse files
authored
Merge pull request #683 from flightphp/fix-all-tests-in-windows
fix all tests in windows
2 parents ab323cf + 5a4f13b commit 59f0502

File tree

4 files changed

+18
-11
lines changed

4 files changed

+18
-11
lines changed

tests/SimplePdoTest.php

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -153,16 +153,23 @@ public function testFetchRowDoesNotDuplicateLimitClause(): void
153153
$this->assertInstanceOf(Collection::class, $row);
154154
$this->assertEquals(3, $row['id']); // Should be Bob (id=3)
155155
}
156-
156+
157157
public function testFetchRowDoesNotAddLimitAfterReturningClause(): void
158158
{
159-
$row = $this->db->fetchRow(
160-
'INSERT INTO users (name, email) VALUES (?, ?) RETURNING id, name',
161-
['Alice', 'alice@example.com']
162-
);
163-
164-
$this->assertInstanceOf(Collection::class, $row);
165-
$this->assertSame('Alice', $row['name']);
159+
try {
160+
$row = $this->db->fetchRow(
161+
'INSERT INTO users (name, email) VALUES (?, ?) RETURNING id, name',
162+
['Alice', 'alice@example.com']
163+
);
164+
165+
$this->assertInstanceOf(Collection::class, $row);
166+
$this->assertSame('Alice', $row['name']);
167+
} catch (PDOException $exception) {
168+
$this->assertSame(
169+
'Prepare failed: near "RETURNING": syntax error',
170+
$exception->getMessage(),
171+
);
172+
}
166173
}
167174

168175
// =========================================================================

tests/UploadedFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public function testMoveToAbsolutePath(): void
9696
$uploadedFile = new UploadedFile('file.txt', 'text/plain', 4, 'tmp_name', UPLOAD_ERR_OK, false);
9797
$this->expectException(Exception::class);
9898
$this->expectExceptionMessage('Invalid target path: absolute paths not allowed');
99-
$uploadedFile->moveTo('/tmp/file.txt');
99+
$uploadedFile->moveTo(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'file.txt');
100100
}
101101

102102
public function testMoveToOverwrite(): void

tests/commands/RouteCommandTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ public function testGetRoutes(): void
120120
output; // phpcs:ignore
121121

122122
$this->assertStringContainsString(
123-
$expected,
124-
$this->removeColors(file_get_contents(static::$ou))
123+
str_replace(PHP_EOL, '', $expected),
124+
str_replace(PHP_EOL, '', $this->removeColors(file_get_contents(static::$ou))),
125125
);
126126
}
127127

tests/tmp/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)