Skip to content

Commit a66e27a

Browse files
author
Ross Mitchell
committed
Removing odd stan changes
1 parent fe937dd commit a66e27a

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/Markdown/LinksChecker.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public static function main(string $projectRootDirectory = null): int
3939
$projectRootDirectory = $projectRootDirectory ?? Helper::getProjectRootDirectory();
4040
$files = static::getFiles($projectRootDirectory);
4141
foreach ($files as $file) {
42-
$relativeFile = str_replace([$projectRootDirectory], [''], $file)[0];
43-
$title = "\n{$relativeFile}\n" . str_repeat('-', strlen($relativeFile[0])) . "\n";
42+
$relativeFile = str_replace([$projectRootDirectory], [''], $file);
43+
$title = "\n{$relativeFile}\n" . str_repeat('-', strlen($relativeFile)) . "\n";
4444
$errors = [];
4545
$links = static::getLinks($file);
4646
foreach ($links as $link) {

tests/Medium/Markdown/LinksCheckerTest.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,7 @@ public function testInvalidProject(): void
4242
4343
Bad link for "incorrect link" to "./foo.md"
4444
';
45-
self::assertResult($pathToProject, $expectedExitCode, $expectedOutput);
46-
}
47-
48-
/**
49-
* @throws Exception
50-
*/
51-
protected function assertResult(string $pathToProject, int $expectedExitCode, string $expectedOutput): void
52-
{
53-
ob_start();
54-
$actualExitCode = LinksChecker::main($pathToProject);
55-
$actualOutput = ob_get_clean();
56-
self::assertSame($expectedOutput, $actualOutput);
57-
self::assertSame($expectedExitCode, $actualExitCode);
45+
$this->assertResult($pathToProject, $expectedExitCode, $expectedOutput);
5846
}
5947

6048
/**
@@ -79,7 +67,7 @@ public function testValidNoDocsFolder(): void
7967
$pathToProject = __DIR__ . '/../../assets/linksChecker/projectWithReadmeNoDocsFolder';
8068
$expectedExitCode = 0;
8169
$expectedOutput = '';
82-
self::assertResult($pathToProject, $expectedExitCode, $expectedOutput);
70+
$this->assertResult($pathToProject, $expectedExitCode, $expectedOutput);
8371
}
8472

8573
/**
@@ -97,6 +85,19 @@ public function testItHandlesNonFileLinks(): void
9785
Bad link for "invalid link" to "https://httpstat.us/404"
9886
result: NULL
9987
';
100-
self::assertResult($pathToProject, $expectedExitCode, $expectedOutput);
88+
$this->assertResult($pathToProject, $expectedExitCode, $expectedOutput);
89+
}
90+
91+
/**
92+
* @throws Exception
93+
*/
94+
protected function assertResult(string $pathToProject, int $expectedExitCode, string $expectedOutput): void
95+
{
96+
ob_start();
97+
$actualExitCode = LinksChecker::main($pathToProject);
98+
$actualOutput = ob_get_clean();
99+
echo $actualOutput;
100+
self::assertSame($expectedOutput, $actualOutput);
101+
self::assertSame($expectedExitCode, $actualExitCode);
101102
}
102103
}

0 commit comments

Comments
 (0)