diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 50e7ab5..ebee202 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,7 +9,7 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.2, 8.1, 8.0] + php: [8.3, 8.2, 8.1, 8.0] dependency-version: [prefer-lowest, prefer-stable] name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 8b6c4c5..e311ad8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ build composer.lock vendor .phpunit.result.cache +.phpunit.cache .php-cs-fixer.cache diff --git a/composer.json b/composer.json index 073e6c0..f5642f6 100644 --- a/composer.json +++ b/composer.json @@ -16,13 +16,13 @@ } ], "require": { - "php": "^7.2 | ^8.0 | ^8.1", + "php": "^7.2 | ^8.0", "clue/stdio-react": "^2.4", "jolicode/jolinotif": "^2.2", - "symfony/console": "^5 | ^6", - "symfony/finder": "^5.4 | ^6", - "symfony/process": "^5.4 | ^6", - "symfony/yaml": "^5.2 | ^6", + "symfony/console": "^5 | ^6 | ^7", + "symfony/finder": "^5.4 | ^6 | ^7", + "symfony/process": "^5.4 | ^6 | ^7", + "symfony/yaml": "^5.2 | ^6 | ^7", "yosymfony/resource-watcher": "^2.0 | ^3.0" }, "conflict": { @@ -30,7 +30,7 @@ "symfony/console": "<5.2" }, "require-dev": { - "phpunit/phpunit": "^8.6 | ^9.0" + "phpunit/phpunit": "^8.6 | ^9.0 | ^11.0" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 22da30c..fa85dc7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,13 +1,14 @@ - - - - src/ - - - - - tests - - + + + + + tests + + + + + src/ + + diff --git a/src/ConsoleApplication.php b/src/ConsoleApplication.php index 8303189..94faf80 100644 --- a/src/ConsoleApplication.php +++ b/src/ConsoleApplication.php @@ -13,7 +13,7 @@ public function __construct() $this->add(new WatcherCommand()); } - public function getLongVersion() + public function getLongVersion(): string { return parent::getLongVersion().' by Spatie'; } diff --git a/src/WatcherCommand.php b/src/WatcherCommand.php index 3255cc1..f91b97c 100644 --- a/src/WatcherCommand.php +++ b/src/WatcherCommand.php @@ -19,7 +19,7 @@ protected function configure() ->addArgument('phpunit-options', InputArgument::OPTIONAL, 'Options passed to phpunit'); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $options = $this->determineOptions($input); @@ -28,6 +28,8 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->displayOptions($options, $input, $output); $watcher->startWatching(); + + return 0; } protected function determineOptions(InputInterface $input): array diff --git a/tests/PhpunitWatcherTest.php b/tests/PhpunitWatcherTest.php index c3178fb..59d6f4a 100644 --- a/tests/PhpunitWatcherTest.php +++ b/tests/PhpunitWatcherTest.php @@ -5,10 +5,11 @@ use PHPUnit\Framework\TestCase; use Spatie\PhpUnitWatcher\OS; use Symfony\Component\Process\Process; +use PHPUnit\Framework\Attributes\Test; class PhpunitWatcherTest extends TestCase { - /** @test */ + #[Test] public function the_watcher_can_be_executed() { $process = new Process(OS::isOnWindows() ? ['php', 'phpunit-watcher'] : ['./phpunit-watcher']); diff --git a/tests/WatcherCommandTest.php b/tests/WatcherCommandTest.php index 33492b1..c320e74 100644 --- a/tests/WatcherCommandTest.php +++ b/tests/WatcherCommandTest.php @@ -2,12 +2,13 @@ namespace Spatie\PhpUnitWatcher\Test; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Spatie\PhpUnitWatcher\WatcherCommand; class WatcherCommandTest extends TestCase { - /** @test */ + #[Test] public function it_can_be_instantiated() { $command = new WatcherCommand(); diff --git a/tests/WatcherFactoryTest.php b/tests/WatcherFactoryTest.php index bc379c1..c69855f 100644 --- a/tests/WatcherFactoryTest.php +++ b/tests/WatcherFactoryTest.php @@ -2,12 +2,13 @@ namespace Spatie\PhpUnitWatcher\Test; +use PHPUnit\Framework\Attributes\Test; use PHPUnit\Framework\TestCase; use Spatie\PhpUnitWatcher\WatcherFactory; class WatcherFactoryTest extends TestCase { - /** @test */ + #[Test] public function it_can_be_instantiated() { $factory = new WatcherFactory(); @@ -15,7 +16,7 @@ public function it_can_be_instantiated() $this->assertInstanceOf(WatcherFactory::class, $factory); } - /** @test */ + #[Test] public function setting_notification_preserves_other_options() { $userOptions = [ @@ -32,7 +33,7 @@ public function setting_notification_preserves_other_options() $this->assertSame('*.php', $actualOptions['watch']['fileMask']); } - /** @test */ + #[Test] public function setting_directories_preserves_other_options() { $userOptions = [