Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions tests/SimplePdoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,23 @@ public function testFetchRowDoesNotDuplicateLimitClause(): void
$this->assertInstanceOf(Collection::class, $row);
$this->assertEquals(3, $row['id']); // Should be Bob (id=3)
}

public function testFetchRowDoesNotAddLimitAfterReturningClause(): void
{
$row = $this->db->fetchRow(
'INSERT INTO users (name, email) VALUES (?, ?) RETURNING id, name',
['Alice', 'alice@example.com']
);

$this->assertInstanceOf(Collection::class, $row);
$this->assertSame('Alice', $row['name']);
try {
$row = $this->db->fetchRow(
'INSERT INTO users (name, email) VALUES (?, ?) RETURNING id, name',
['Alice', 'alice@example.com']
);

$this->assertInstanceOf(Collection::class, $row);
$this->assertSame('Alice', $row['name']);
} catch (PDOException $exception) {
$this->assertSame(
'Prepare failed: near "RETURNING": syntax error',
$exception->getMessage(),
);
}
}

// =========================================================================
Expand Down
2 changes: 1 addition & 1 deletion tests/UploadedFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function testMoveToAbsolutePath(): void
$uploadedFile = new UploadedFile('file.txt', 'text/plain', 4, 'tmp_name', UPLOAD_ERR_OK, false);
$this->expectException(Exception::class);
$this->expectExceptionMessage('Invalid target path: absolute paths not allowed');
$uploadedFile->moveTo('/tmp/file.txt');
$uploadedFile->moveTo(__DIR__ . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'file.txt');
}

public function testMoveToOverwrite(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/RouteCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ public function testGetRoutes(): void
output; // phpcs:ignore

$this->assertStringContainsString(
$expected,
$this->removeColors(file_get_contents(static::$ou))
str_replace(PHP_EOL, '', $expected),
str_replace(PHP_EOL, '', $this->removeColors(file_get_contents(static::$ou))),
);
}

Expand Down
Empty file added tests/tmp/.gitkeep
Empty file.
Loading