Skip to content
Open
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
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ concurrency:

jobs:
tests:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
php:
- '7.4'
- '8.0'
Expand Down
13 changes: 11 additions & 2 deletions tests/TicketSwapErrorFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
);
}

private static function isWindows() : bool
{
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
}

/**
* @return iterable<array{TicketSwapErrorFormatter::LINK_FORMAT_*, array<string, string>}>
*/
Expand Down Expand Up @@ -83,7 +88,9 @@ public function testGetLinkFormatFromEnv(string $expected, array $environmentVar
public static function provideLinkFormats() : iterable
{
yield [
"↳ <href=phpstorm://open?file=/www/project/src/Core/Admin/Controller/Dashboard/User/AddUserController.php&line=20>src/Core/Admin/.../User/AddUserController.php:20</>\n",
self::isWindows()
? "↳ <href=phpstorm://open?file=/www/project/src/Core/Admin/Controller/Dashboard/User/AddUserController.php&line=20>src/Core/Admin/Controller/Dashboard/User/AddUserController.php:20</>\n"
: "↳ <href=phpstorm://open?file=/www/project/src/Core/Admin/Controller/Dashboard/User/AddUserController.php&line=20>src/Core/Admin/.../User/AddUserController.php:20</>\n",
TicketSwapErrorFormatter::LINK_FORMAT_DEFAULT,
20,
'/www/project/src/Core/Admin/Controller/Dashboard/User/AddUserController.php',
Expand Down Expand Up @@ -433,7 +440,9 @@ public function testFormatErrorsWithErrorsPrintsMessagesLinksSummaryAndReturnsOn

self::assertSame(1, $result);

$expectedLink = "↳ <href=phpstorm://open?file=/www/project/src/Foo/Bar.php&line=12>/www/project/.../Foo/Bar.php:12</>\n";
$expectedLink = self::isWindows()
? "↳ <href=phpstorm://open?file=/www/project/src/Foo/Bar.php&line=12>/www/project/src/Foo/Bar.php:12</>\n"
: "↳ <href=phpstorm://open?file=/www/project/src/Foo/Bar.php&line=12>/www/project/.../Foo/Bar.php:12</>\n";
$expectedSummary = '<bg=red;options=bold>Found 1 error</>';

$writes = $output->getWrites();
Expand Down