Skip to content

Commit fa2e139

Browse files
committed
Allow comments in baseline
1 parent c288c1a commit fa2e139

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ return [
4545
Tiime\TestedRoutesCheckerBundle\TiimeTestedRoutesCheckerBundle::class => ['dev' => true, 'test' => true],
4646
];
4747
```
48+
49+
## Using baseline to ignore some routes
50+
51+
You can ignore some routes with a `.tiime-trc-baseline` file with 1 route per line.

src/IgnoredRoutesStorage.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ public function getRoutes(): array
5353
throw new \RuntimeException('Unable to load ignored routes from given file.');
5454
}
5555

56+
$routes = array_filter($routes, static function (string $route): bool {
57+
return !str_starts_with($route, '#');
58+
});
59+
5660
return array_values(array_unique($routes));
5761
}
5862
}

tests/IgnoredRoutesStorageTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public function testStorage(): void
2828
$storage->saveRoute('route1');
2929
$storage->saveRoute('route2');
3030
$storage->saveRoute('route3');
31+
$storage->saveRoute('# This is a comment which will be ignored');
3132
$storage->saveRoute('route2');
3233
$storage->saveRoutes(['route2', 'route4', 'route5']);
3334

0 commit comments

Comments
 (0)