Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
feat: upgrade to core v4
Browse files Browse the repository at this point in the history
Add `phpDocHeader` option.

BREAKING CHANGE: PHP 8.0 is no more supported.
  • Loading branch information
paul-thebaud committed Dec 17, 2023
1 parent 0fec0e7 commit 364d758
Show file tree
Hide file tree
Showing 13 changed files with 48 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

strategy:
matrix:
php: [ 8.0, 8.1, 8.2 ]
php: [ 8.1, 8.2 ]
os: [ ubuntu-latest, windows-latest ]

name: PHP${{ matrix.php }} - ${{ matrix.os }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@
# Cache and coverage.
/\.coverage/
/\.phpunit\.result\.cache
/\.phpunit\.cache/
\.scannerwork/
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 6.0.0

**Added**

- Add `phpHeaderDoc` option to generate a documentation block in generated file header.

**Changed**

- **BREAKING** Drop support for PHP 8.0.

## 5.0.0

**Added**
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@
"bin/phpunitgen"
],
"require": {
"php": "~8.0.12 || ~8.1.0 || ~8.2.0",
"php": "~8.1.0 || ~8.2.0",
"ext-json": "*",
"league/container": "^3.3",
"league/flysystem": "^3.0",
"phpunitgen/core": "^3.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0",
"symfony/stopwatch": "^4.3 || ^5.0 || ^6.0",
"symfony/yaml": "^4.3 || ^5.0 || ^6.0",
"phpunitgen/core": "^4.0",
"symfony/console": "^4.4 || ^5.0 || ^6.0 || ^7.0",
"symfony/stopwatch": "^4.3 || ^5.0 || ^6.0 || ^7.0",
"symfony/yaml": "^4.3 || ^5.0 || ^6.0 || ^7.0",
"tightenco/collect": "^8.0 || ^9.0"
},
"require-dev": {
"laravel/framework": "^9.0",
"mockery/mockery": "^1.3",
"orchestra/testbench": "^7.0",
"phpunit/phpunit": "^9.1"
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
Expand Down
1 change: 1 addition & 0 deletions config/phpunitgen.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"version"
],
"phpDoc": [],
"phpHeaderDoc": "",
"options": {
"context": "laravel"
}
Expand Down
11 changes: 11 additions & 0 deletions config/phpunitgen.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,17 @@
*/
'phpDoc' => [],

/*
|--------------------------------------------------------------------------
| PHP header documentation lines.
|
| The documentation header to append to generated files.
| Should be a full documentation content (with lines breaks, opening tags,
| etc.) or an empty string to disable printing a documentation header.
|--------------------------------------------------------------------------
*/
'phpHeaderDoc' => '',

/*
|--------------------------------------------------------------------------
| Options.
Expand Down
1 change: 1 addition & 0 deletions config/phpunitgen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ mergedPhpDoc:
- license
- version
phpDoc: []
phpHeaderDoc:
options:
context: laravel
1 change: 1 addition & 0 deletions src/Config/ConsoleConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class ConsoleConfig extends Config implements ConsoleConfigContract
'excludedMethods' => self::TYPE_ARRAY,
'mergedPhpDoc' => self::TYPE_ARRAY,
'phpDoc' => self::TYPE_ARRAY,
'phpHeaderDoc' => self::TYPE_STRING,
'options' => self::TYPE_ARRAY,
'overwriteFiles' => self::TYPE_BOOL,
'excludedFiles' => self::TYPE_ARRAY,
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/CommandFinishedListenerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ public function testItRunsWithClass(string $expectedPath, string $makeName): voi
$this->assertSame(1, $this->commandFinishedListener->handle($event));
}

public function runWithClassDataProvider(): array
public static function runWithClassDataProvider(): array
{
return [
['Broadcasting', 'channel'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/CommandsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public function testItRunsWithExistingConfig(string $commandClass): void
$this->assertStringContainsString('Memory usage:', $output);
}

public function commandsDataProvider(): array
public static function commandsDataProvider(): array
{
return [
[RunCommand::class],
Expand Down
8 changes: 8 additions & 0 deletions tests/Feature/LaravelIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ protected function deleteAffectedDirectories(): void
}
}

/**
* {@inheritdoc}
*/
protected function defineEnvironment($app)
{
$app['env'] = 'local';
}

/**
* {@inheritdoc}
*/
Expand Down
5 changes: 5 additions & 0 deletions tests/Unit/Config/ConsoleConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public function testWhenDefaultConfiguration(): void
'version',
],
'phpDoc' => [],
'phpHeaderDoc' => '',
'options' => [
'context' => 'laravel',
],
Expand Down Expand Up @@ -73,6 +74,7 @@ public function testWhenCompleteConfiguration(): void
'excludedMethods' => [],
'mergedPhpDoc' => [],
'phpDoc' => ['@author John Doe'],
'phpHeaderDoc' => '/* Some header */',
'options' => ['custom' => 'option'],
], ConsoleConfig::make([
'overwriteFiles' => true,
Expand All @@ -95,6 +97,7 @@ public function testWhenCompleteConfiguration(): void
'excludedMethods' => [],
'mergedPhpDoc' => [],
'phpDoc' => ['@author John Doe'],
'phpHeaderDoc' => '/* Some header */',
'options' => ['custom' => 'option'],
])->toArray());
}
Expand Down Expand Up @@ -122,6 +125,7 @@ public function testGetters(): void
'excludedMethods' => [],
'mergedPhpDoc' => [],
'phpDoc' => ['@author John Doe'],
'phpHeaderDoc' => '/* Some header */',
'options' => ['custom' => 'option'],
]);

Expand All @@ -145,6 +149,7 @@ public function testGetters(): void
$this->assertSame([], $config->excludedMethods());
$this->assertSame([], $config->mergedPhpDoc());
$this->assertSame(['@author John Doe'], $config->phpDoc());
$this->assertSame('/* Some header */', $config->phpHeaderDoc());
$this->assertSame(['custom' => 'option'], $config->options());
$this->assertSame('option', $config->getOption('custom'));
$this->assertSame(null, $config->getOption('unknown'));
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/Files/TargetResolverTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function testItResolvesTargetPath(
$this->assertSame($expected, $this->targetResolver->resolve($classFactory, $sourcePath, $targetPath));
}

public function targetResolverDataProvider(): array
public static function targetResolverDataProvider(): array
{
return [
['tests/Models/PostTest.php', '', 'john/app/Models/Post.php', 'tests'],
Expand Down

0 comments on commit 364d758

Please sign in to comment.