diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 0688d67..5cd87b3 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -18,10 +18,11 @@ jobs: - "8.3" - "8.4" - "8.5" + - "8.6" steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v7 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -35,7 +36,7 @@ jobs: run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache dependencies installed with composer - uses: actions/cache@v3 + uses: actions/cache@v6 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} @@ -48,6 +49,6 @@ jobs: run: vendor/bin/phpunit --colors=always --coverage-clover clover.xml - name: Send code coverage report to Codecov.io - uses: codecov/codecov-action@v5 + uses: codecov/codecov-action@v7 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 63e06de..2763b9c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -18,10 +18,11 @@ jobs: - "8.3" - "8.4" - "8.5" + - "8.6" steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v7 - name: Install PHP uses: shivammathur/setup-php@v2 @@ -35,7 +36,7 @@ jobs: run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV - name: Cache dependencies installed with composer - uses: actions/cache@v4 + uses: actions/cache@v6 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }} diff --git a/README.md b/README.md index c51faba..c69a3ab 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ Documentation is available at: https://docs.dotkernel.org/dot-maker/. [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/blob/2.0/LICENSE) -[![Build Static](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml/badge.svg?branch=2.0)](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml/badge.svg?branch=2.x)](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-maker/graph/badge.svg?token=KT9UA402B4)](https://codecov.io/gh/dotkernel/dot-maker) -[![PHPStan](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml/badge.svg?branch=2.0)](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml) +[![PHPStan](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml/badge.svg?branch=2.x)](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml) ## Installation diff --git a/composer.json b/composer.json index 7250728..53dd5b6 100644 --- a/composer.json +++ b/composer.json @@ -28,7 +28,7 @@ } }, "require": { - "php": "~8.3.0 || ~8.4.0 || ~8.5.0" + "php": "~8.3.0 || ~8.4.0 || ~8.5.0 || ~8.6.0" }, "require-dev": { "boundwize/structarmed": "^0.19", @@ -36,7 +36,7 @@ "mikey179/vfsstream": "^1.6.12", "phpstan/phpstan": "^2.1.33", "phpstan/phpstan-phpunit": "^2.0.10", - "phpunit/phpunit": "^10.5.60" + "phpunit/phpunit": "^12.5.22" }, "scripts": { "check": [ diff --git a/docs/book/v2/overview.md b/docs/book/v2/overview.md index f6b9c2e..68ac60f 100644 --- a/docs/book/v2/overview.md +++ b/docs/book/v2/overview.md @@ -12,9 +12,9 @@ Programmatically generate Dotkernel project files and directories. [![GitHub stars](https://img.shields.io/github/stars/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/stargazers) [![GitHub license](https://img.shields.io/github/license/dotkernel/dot-maker)](https://github.com/dotkernel/dot-maker/blob/2.0/LICENSE) -[![Build Static](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml/badge.svg?branch=2.0)](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml) +[![Build Static](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml/badge.svg?branch=2.x)](https://github.com/dotkernel/dot-maker/actions/workflows/continuous-integration.yml) [![codecov](https://codecov.io/gh/dotkernel/dot-maker/graph/badge.svg?token=KT9UA402B4)](https://codecov.io/gh/dotkernel/dot-maker) -[![PHPStan](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml/badge.svg?branch=2.0)](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml) +[![PHPStan](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml/badge.svg?branch=2.x)](https://github.com/dotkernel/dot-maker/actions/workflows/static-analysis.yml) Make sure you run through our guides on using the [inputs](./io/input.md) and the [outputs](./io/output.md). diff --git a/phpunit.xml b/phpunit.xml index 52cc404..f70f3a1 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,6 +1,6 @@ diff --git a/test/FileSystem/FileTest.php b/test/FileSystem/FileTest.php index 2d186a7..b9eae2b 100644 --- a/test/FileSystem/FileTest.php +++ b/test/FileSystem/FileTest.php @@ -10,6 +10,7 @@ use org\bovigo\vfs\vfsStream; use org\bovigo\vfs\vfsStreamContent; use org\bovigo\vfs\vfsStreamDirectory; +use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations; use PHPUnit\Framework\TestCase; use function sprintf; @@ -45,6 +46,7 @@ public function testWillInstantiate(): void $this->assertContainsOnlyInstancesOf(File::class, [$file]); } + #[AllowMockObjectsWithoutExpectations] public function testFailingToCreateWillThrowAnError(): void { $file = $this->getMockBuilder(File::class) diff --git a/test/IO/InputTest.php b/test/IO/InputTest.php index dbe83e7..8777721 100644 --- a/test/IO/InputTest.php +++ b/test/IO/InputTest.php @@ -6,6 +6,7 @@ use Dot\Maker\IO\Input; use Dot\Maker\IO\Output; +use PHPUnit\Framework\Attributes\TestWith; use PHPUnit\Framework\TestCase; use function fclose; @@ -60,13 +61,11 @@ public function testPromptWillOutputMessageAndReadInput(): void fclose($outputStream); } - /** - * @testWith [""] - * ["y"] - * ["yes"] - * ["Y"] - * ["Yes"] - */ + #[TestWith([''])] + #[TestWith(['y'])] + #[TestWith(['yes'])] + #[TestWith(['Y'])] + #[TestWith(['Yes'])] public function testConfirmWillOutputMessageAndReadPositiveAnswer(string $input): void { $outputStream = fopen('php://memory', 'w+'); @@ -86,13 +85,11 @@ public function testConfirmWillOutputMessageAndReadPositiveAnswer(string $input) fclose($outputStream); } - /** - * @testWith [""] - * ["n"] - * ["no"] - * ["N"] - * ["No"] - */ + #[TestWith([''])] + #[TestWith(['n'])] + #[TestWith(['no'])] + #[TestWith(['N'])] + #[TestWith(['No'])] public function testConfirmWillOutputMessageAndReadNegativeAnswer(string $input): void { $outputStream = fopen('php://memory', 'w+'); diff --git a/test/MakerTest.php b/test/MakerTest.php index 194df4f..45bd394 100644 --- a/test/MakerTest.php +++ b/test/MakerTest.php @@ -9,6 +9,7 @@ use Dot\Maker\IO\Output; use Dot\Maker\Maker; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\AllowMockObjectsWithoutExpectations; use PHPUnit\Framework\TestCase; use function fclose; @@ -19,6 +20,7 @@ use const PHP_EOL; +#[AllowMockObjectsWithoutExpectations] class MakerTest extends TestCase { /** @var resource $outputStream */ diff --git a/test/Type/CommandTest.php b/test/Type/CommandTest.php index 15ad72f..b2710c0 100644 --- a/test/Type/CommandTest.php +++ b/test/Type/CommandTest.php @@ -14,6 +14,7 @@ use Dot\Maker\Type\Command; use Dot\Maker\Type\Module; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function fclose; @@ -147,9 +148,7 @@ public function testCallToInvokeWillOutputErrorAndWillNotCreateFileWhenNameIsInv $this->assertFileDoesNotExist($file->getPath()); } - /** - * @dataProvider dataProviderWithoutService - */ + #[DataProvider('dataProviderWithoutService')] public function testCallToInvokeWithoutServiceWillSucceedWhenNameIsValid(string $expected): void { $file = $this->fileSystem->command($this->resourceName); @@ -191,9 +190,7 @@ public function testCallToInvokeWithServiceWillSucceedWhenNameIsValid(): void $this->assertSame($this->dataProviderWithService($serviceInterface), $file->read()); } - /** - * @dataProvider dataProviderWithoutService - */ + #[DataProvider('dataProviderWithoutService')] public function testCallToCreateWithoutServiceWillSucceedWhenNameIsValid(string $expected): void { $file = $this->fileSystem->command($this->resourceName); diff --git a/test/Type/EntityTest.php b/test/Type/EntityTest.php index da9077f..d00ad80 100644 --- a/test/Type/EntityTest.php +++ b/test/Type/EntityTest.php @@ -12,6 +12,7 @@ use Dot\Maker\Type\Entity; use Dot\Maker\Type\Module; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function fclose; @@ -145,9 +146,7 @@ public function testCallToInvokeWillOutputErrorAndWillNotCreateFileWhenNameIsInv $this->assertFileDoesNotExist($file->getPath()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testCallToInvokeWillSucceedWhenNameIsValid(string $expected): void { $file = $this->fileSystem->entity($this->resourceName); @@ -166,9 +165,7 @@ public function testCallToInvokeWillSucceedWhenNameIsValid(string $expected): vo $this->assertSame($expected, $file->read()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testCallToCreateWillSucceedWhenNameIsValid(string $expected): void { $file = $this->fileSystem->entity($this->resourceName); diff --git a/test/Type/RepositoryTest.php b/test/Type/RepositoryTest.php index c841c49..a894ce6 100644 --- a/test/Type/RepositoryTest.php +++ b/test/Type/RepositoryTest.php @@ -12,6 +12,7 @@ use Dot\Maker\Type\Module; use Dot\Maker\Type\Repository; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function fclose; @@ -145,9 +146,7 @@ public function testCallToInvokeWillOutputErrorAndWillNotCreateFileWhenNameIsInv $this->assertFileDoesNotExist($file->getPath()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testCallToInvokeWillSucceedWhenNameIsValid(string $expected): void { $file = $this->fileSystem->repository($this->resourceName); @@ -166,9 +165,7 @@ public function testCallToInvokeWillSucceedWhenNameIsValid(string $expected): vo $this->assertSame($expected, $file->read()); } - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testCallToCreateWillSucceedWhenNameIsValid(string $expected): void { $file = $this->fileSystem->repository($this->resourceName); diff --git a/test/Type/RoutesDelegatorTest.php b/test/Type/RoutesDelegatorTest.php index 0085f5d..9c7cfc0 100644 --- a/test/Type/RoutesDelegatorTest.php +++ b/test/Type/RoutesDelegatorTest.php @@ -11,6 +11,7 @@ use Dot\Maker\IO\Output; use Dot\Maker\Type\RoutesDelegator; use org\bovigo\vfs\vfsStream; +use PHPUnit\Framework\Attributes\DataProvider; use PHPUnit\Framework\TestCase; use function fclose; @@ -26,9 +27,7 @@ class RoutesDelegatorTest extends TestCase private string $moduleName = 'ModuleName'; private string $resourceName = 'BookStore'; - /** - * @dataProvider dataProvider - */ + #[DataProvider('dataProvider')] public function testCallToCreateWhenProjectTypeIsNotApiWillCreateFile(string $expected): void { $stream = fopen('php://memory', 'w+'); @@ -73,9 +72,7 @@ public function testCallToCreateWhenProjectTypeIsNotApiWillCreateFile(string $ex fclose($stream); } - /** - * @dataProvider dataProviderApi - */ + #[DataProvider('dataProviderApi')] public function testCallToCreateWhenProjectTypeIsApiWillCreateFile(string $expected): void { $stream = fopen('php://memory', 'w+');