Skip to content

Commit f45a9b2

Browse files
committed
feat: add GitHub source tests with various configurations and mock client
1 parent ec0d866 commit f45a9b2

File tree

9 files changed

+560
-0
lines changed

9 files changed

+560
-0
lines changed

src/Lib/PathFilter/AbstractFilter.php

+5
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ protected function matchPattern(string $value, string|array $pattern): bool
2525
$patterns = \is_array($pattern) ? $pattern : [$pattern];
2626

2727
foreach ($patterns as $p) {
28+
if (\str_contains($value, $p)) {
29+
return true;
30+
}
31+
2832
if (!FileHelper::isRegex($pattern)) {
2933
$p = FileHelper::toRegex($p);
3034
}
35+
3136
if ($this->matchGlob($value, $p)) {
3237
return true;
3338
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
documents:
2+
- description: "Basic GitHub Source Test"
3+
outputPath: "github-source.md"
4+
sources:
5+
- type: github
6+
description: "Basic GitHub Source"
7+
repository: "owner/repo"
8+
sourcePaths: "src"
9+
branch: "main"
10+
filePattern: "*.php"
11+
showTreeView: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
documents:
2+
- description: "Filtered GitHub Source"
3+
outputPath: "filtered-github.md"
4+
sources:
5+
- type: github
6+
description: "Filtered GitHub Source"
7+
repository: "owner/repo"
8+
sourcePaths: "src"
9+
branch: "main"
10+
filePattern: "*.php"
11+
path: "Controller"
12+
showTreeView: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
documents:
2+
- description: "Multiple Paths GitHub Source"
3+
outputPath: "multiple-paths-github.md"
4+
sources:
5+
- type: github
6+
description: "Multiple Paths GitHub Source"
7+
repository: "owner/repo"
8+
sourcePaths:
9+
- src/Controller
10+
- tests
11+
branch: "main"
12+
filePattern: "*.php"
13+
showTreeView: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
documents:
2+
- description: "GitHub Tree View Test"
3+
outputPath: "tree-view-github.md"
4+
sources:
5+
- type: github
6+
description: "GitHub Tree View Test"
7+
repository: "owner/repo"
8+
sourcePaths: "src"
9+
branch: "main"
10+
filePattern: "*.php"
11+
showTreeView: true
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
documents:
2+
- description: "Private GitHub Repository"
3+
outputPath: "private-github.md"
4+
sources:
5+
- type: github
6+
description: "Private GitHub Repository"
7+
repository: "owner/private-repo"
8+
sourcePaths: "src"
9+
branch: "main"
10+
filePattern: "*.php"
11+
showTreeView: true
12+
githubToken: "${GITHUB_TOKEN}"

tests/src/Feature/Console/GenerateCommand/CompilingResult.php

+1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function assertContext(string $document, array $contains, array $notConta
5050
);
5151

5252
$content = \file_get_contents($contextPath);
53+
trap($content);
5354
foreach ($contains as $string) {
5455
TestCase::assertStringContainsString(
5556
$string,

0 commit comments

Comments
 (0)