Skip to content

Commit

Permalink
Test for editorUrl with relative path
Browse files Browse the repository at this point in the history
  • Loading branch information
Wirone committed Jun 15, 2022
1 parent 5c50533 commit 6e9999c
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@ public function testEditorUrlWithTrait(): void
$this->assertStringContainsString('Bar.php', $this->getOutputContent());
}

public function testEditorUrlWithRelativePath(): void
{
$relativePathHelper = new FuzzyRelativePathHelper(new NullRelativePathHelper(), self::DIRECTORY_PATH, [], '/');
$formatter = new TableErrorFormatter($relativePathHelper, new CiDetectedErrorFormatter(
new GithubErrorFormatter($relativePathHelper),
new TeamcityErrorFormatter($relativePathHelper),
), false, 'editor://custom/path/%relFile%/%line%');
$error = new Error('Test', 'Foo.php', 12, true, self::DIRECTORY_PATH . '/rel/Foo.php');
$formatter->formatErrors(new AnalysisResult([$error], [], [], [], false, null, true), $this->getOutput(true));

$this->assertStringContainsString('editor://custom/path/rel/Foo.php', $this->getOutputContent(true));
}

public function testBug6727(): void
{
putenv('COLUMNS=30');
Expand Down

0 comments on commit 6e9999c

Please sign in to comment.