Skip to content

Commit 2281c63

Browse files
committed
Add covers annotations
1 parent 3582ab1 commit 2281c63

File tree

6 files changed

+42
-1
lines changed

6 files changed

+42
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/.coverage
12
/vendor
23
/.phpunit.result.cache
34
/composer.lock

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
}
1111
],
1212
"scripts": {
13-
"coverage": "php -d pcov.enabled=1 -d pcov.directory=src -d pcov.exclude='~vendor~' vendor/bin/phpunit --coverage-text"
13+
"coverage": "php -d pcov.enabled=1 -d pcov.directory=src -d pcov.exclude='~vendor~' vendor/bin/phpunit"
1414
},
1515
"require": {
1616
"php": "^8.0",

phpunit.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
55
colors="true"
6+
forceCoversAnnotation="true"
7+
beStrictAboutCoversAnnotation="true"
68
>
79
<testsuites>
810
<testsuite name="Unit">
@@ -14,5 +16,9 @@
1416
<include>
1517
<directory suffix=".php">src</directory>
1618
</include>
19+
20+
<report>
21+
<html outputDirectory=".coverage"/>
22+
</report>
1723
</coverage>
1824
</phpunit>

tests/Commands/GenerateQuestions/ArtisanOptimizeQuestionTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
use BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\ArtisanOptimizeQuestion;
77
use BlameButton\LaravelDockerBuilder\Tests\TestCase;
88

9+
/**
10+
* @uses \BlameButton\LaravelDockerBuilder\DockerServiceProvider
11+
* @uses \BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\Choices\ArtisanOptimize
12+
* @covers \BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\ArtisanOptimizeQuestion
13+
*/
914
class ArtisanOptimizeQuestionTest extends TestCase
1015
{
1116
private function provideOptions(): array

tests/Commands/GenerateQuestions/NodeBuildToolQuestionTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
use BlameButton\LaravelDockerBuilder\Tests\TestCase;
1111
use Mockery\MockInterface;
1212

13+
/**
14+
* @uses \BlameButton\LaravelDockerBuilder\DockerServiceProvider
15+
* @uses \BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\Choices\NodeBuildTool
16+
* @covers \BlameButton\LaravelDockerBuilder\Commands\GenerateQuestions\NodeBuildToolQuestion
17+
*/
1318
class NodeBuildToolQuestionTest extends TestCase
1419
{
1520
public function testItThrowsErrorOnInvalidInput(): void
@@ -26,6 +31,27 @@ public function testItThrowsErrorOnInvalidInput(): void
2631
app(NodeBuildToolQuestion::class)->getAnswer($mock);
2732
}
2833

34+
private function provideOptions(): array
35+
{
36+
return [
37+
'vite' => [NodeBuildTool::VITE, 'vite'],
38+
'mix' => [NodeBuildTool::MIX, 'mix'],
39+
];
40+
}
41+
42+
/** @dataProvider provideOptions */
43+
public function testItHandlesOptions($expected, $input): void
44+
{
45+
$mock = $this->createMock(BaseCommand::class);
46+
$mock->expects($this->once())
47+
->method('option')
48+
->willReturnMap([
49+
['node-build-tool', $input],
50+
]);
51+
52+
$answer = app(NodeBuildToolQuestion::class)->getAnswer($mock);
53+
}
54+
2955
public function provideDetectedBuildTools(): array
3056
{
3157
return [
@@ -52,4 +78,5 @@ public function testItDetectsBuildTools($expected, $detected): void
5278

5379
self::assertEquals($expected, $answer);
5480
}
81+
5582
}

tests/TestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
use BlameButton\LaravelDockerBuilder\DockerServiceProvider;
66
use Orchestra\Testbench\TestCase as Orchestra;
77

8+
/**
9+
*/
810
class TestCase extends Orchestra
911
{
1012
protected function getPackageProviders($app): array

0 commit comments

Comments
 (0)