From 983d8394d2e025d609ec58cab58c63f863965c73 Mon Sep 17 00:00:00 2001 From: Michael Withagen Date: Wed, 15 May 2024 12:52:15 +0200 Subject: [PATCH 1/5] Bump symfony package version and update resource watcher --- .gitignore | 1 + composer.json | 18 ++++++++++++------ phpunit.xml.dist | 23 ++++++++++++----------- src/ConsoleApplication.php | 2 +- src/WatcherCommand.php | 4 +++- tests/PhpunitWatcherTest.php | 2 ++ tests/WatcherCommandTest.php | 2 ++ tests/WatcherFactoryTest.php | 4 ++++ 8 files changed, 37 insertions(+), 19 deletions(-) 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..4fdde69 100644 --- a/composer.json +++ b/composer.json @@ -15,14 +15,20 @@ "role": "Developer" } ], + "repositories": [ + { + "type": "vcs", + "url": "https://github.com/michaelw85/resource-watcher" + } + ], "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 +36,7 @@ "symfony/console": "<5.2" }, "require-dev": { - "phpunit/phpunit": "^8.6 | ^9.0" + "phpunit/phpunit": "^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..9d52911 100644 --- a/tests/PhpunitWatcherTest.php +++ b/tests/PhpunitWatcherTest.php @@ -5,10 +5,12 @@ 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..09a10c5 100644 --- a/tests/WatcherCommandTest.php +++ b/tests/WatcherCommandTest.php @@ -2,12 +2,14 @@ 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..5cd6518 100644 --- a/tests/WatcherFactoryTest.php +++ b/tests/WatcherFactoryTest.php @@ -2,12 +2,14 @@ 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(); @@ -16,6 +18,7 @@ public function it_can_be_instantiated() } /** @test */ + #[Test] public function setting_notification_preserves_other_options() { $userOptions = [ @@ -33,6 +36,7 @@ public function setting_notification_preserves_other_options() } /** @test */ + #[Test] public function setting_directories_preserves_other_options() { $userOptions = [ From 4773a8ac19bcbb5031f1347b70dbb28d25cb0874 Mon Sep 17 00:00:00 2001 From: Michael Withagen Date: Wed, 15 May 2024 13:32:00 +0200 Subject: [PATCH 2/5] Force new version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 4fdde69..a8d4cee 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,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" + "yosymfony/resource-watcher": "^2.0 | ^3.1" }, "conflict": { "yosymfony/resource-watcher": "<2.0", From 6445a7523cc6b8fd2925d097823e3663585d8db7 Mon Sep 17 00:00:00 2001 From: Michael Withagen Date: Wed, 15 May 2024 13:39:23 +0200 Subject: [PATCH 3/5] Revert change --- composer.json | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/composer.json b/composer.json index a8d4cee..330adf1 100644 --- a/composer.json +++ b/composer.json @@ -15,12 +15,6 @@ "role": "Developer" } ], - "repositories": [ - { - "type": "vcs", - "url": "https://github.com/michaelw85/resource-watcher" - } - ], "require": { "php": "^7.2 | ^8.0", "clue/stdio-react": "^2.4", @@ -29,7 +23,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.1" + "yosymfony/resource-watcher": "^2.0 | ^3.0" }, "conflict": { "yosymfony/resource-watcher": "<2.0", From ded96c8dced0b8085cec4655ca36b72ce6ba0b9b Mon Sep 17 00:00:00 2001 From: Michael Withagen Date: Wed, 15 May 2024 15:08:58 +0200 Subject: [PATCH 4/5] Update test run with php 8.3 and re-add older phpunit versions --- .github/workflows/run-tests.yml | 2 +- composer.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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/composer.json b/composer.json index 330adf1..f5642f6 100644 --- a/composer.json +++ b/composer.json @@ -30,7 +30,7 @@ "symfony/console": "<5.2" }, "require-dev": { - "phpunit/phpunit": "^11.0" + "phpunit/phpunit": "^8.6 | ^9.0 | ^11.0" }, "autoload": { "psr-4": { From ff5ee6d7d49ca499cb03f9a43754b3f3f3c4b35a Mon Sep 17 00:00:00 2001 From: Michael Withagen Date: Thu, 16 May 2024 10:59:57 +0200 Subject: [PATCH 5/5] Remove doc blocks in favor of annotations --- tests/PhpunitWatcherTest.php | 1 - tests/WatcherCommandTest.php | 1 - tests/WatcherFactoryTest.php | 3 --- 3 files changed, 5 deletions(-) diff --git a/tests/PhpunitWatcherTest.php b/tests/PhpunitWatcherTest.php index 9d52911..59d6f4a 100644 --- a/tests/PhpunitWatcherTest.php +++ b/tests/PhpunitWatcherTest.php @@ -9,7 +9,6 @@ class PhpunitWatcherTest extends TestCase { - /** @test */ #[Test] public function the_watcher_can_be_executed() { diff --git a/tests/WatcherCommandTest.php b/tests/WatcherCommandTest.php index 09a10c5..c320e74 100644 --- a/tests/WatcherCommandTest.php +++ b/tests/WatcherCommandTest.php @@ -8,7 +8,6 @@ class WatcherCommandTest extends TestCase { - /** @test */ #[Test] public function it_can_be_instantiated() { diff --git a/tests/WatcherFactoryTest.php b/tests/WatcherFactoryTest.php index 5cd6518..c69855f 100644 --- a/tests/WatcherFactoryTest.php +++ b/tests/WatcherFactoryTest.php @@ -8,7 +8,6 @@ class WatcherFactoryTest extends TestCase { - /** @test */ #[Test] public function it_can_be_instantiated() { @@ -17,7 +16,6 @@ public function it_can_be_instantiated() $this->assertInstanceOf(WatcherFactory::class, $factory); } - /** @test */ #[Test] public function setting_notification_preserves_other_options() { @@ -35,7 +33,6 @@ public function setting_notification_preserves_other_options() $this->assertSame('*.php', $actualOptions['watch']['fileMask']); } - /** @test */ #[Test] public function setting_directories_preserves_other_options() {