Skip to content

Commit 85e6765

Browse files
author
ityaozm@gmail.com
committedOct 15, 2024
test(Unit): Add GithubCopilotCliGeneratorTest
- Add new file `GithubCopilotCliGeneratorTest.php` to `tests/Unit/Generators` directory - Add PHP code to the file - Configure `generators.github_copilot_cli.binary` to `github-copilot-cli` - Generate error using `GeneratorManager` driver - Expect `ProcessFailedException` to be thrown
1 parent afc812f commit 85e6765

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
/** @noinspection AnonymousFunctionStaticInspection */
4+
/** @noinspection JsonEncodingApiUsageInspection */
5+
/** @noinspection NullPointerExceptionInspection */
6+
/** @noinspection PhpUnhandledExceptionInspection */
7+
/** @noinspection PhpUnused */
8+
/** @noinspection PhpUnusedAliasInspection */
9+
/** @noinspection StaticClosureCanBeUsedInspection */
10+
11+
declare(strict_types=1);
12+
13+
/**
14+
* This file is part of the guanguans/ai-commit.
15+
*
16+
* (c) guanguans <ityaozm@gmail.com>
17+
*
18+
* This source file is subject to the MIT license that is bundled.
19+
*/
20+
21+
use App\GeneratorManager;
22+
use Symfony\Component\Process\Exception\ProcessFailedException;
23+
24+
beforeEach(function (): void {
25+
});
26+
27+
it('throws `ProcessFailedException`', function (): void {
28+
config('ai-commit')->set('generators.github_copilot_cli.binary', 'github-copilot-cli');
29+
expect(app(GeneratorManager::class)->driver('github_copilot_cli'))->generate('error');
30+
})->group(__DIR__, __FILE__)->throws(ProcessFailedException::class);

0 commit comments

Comments
 (0)