diff --git a/.wp-env.json b/.wp-env.json index 2c3c1d6..3997120 100644 --- a/.wp-env.json +++ b/.wp-env.json @@ -1,5 +1,5 @@ { - "core": "WordPress/WordPress#6.2", + "core": "./vendor/roots/wordpress-no-content", "themes": ["./.development/themes/test-theme"], "env": { "development": { diff --git a/composer.json b/composer.json index b11f39a..ba0b5e2 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "brain/monkey": "^2.6", "mikey179/vfsstream": "^2.0", "mockery/mockery": "^1.5", - "inpsyde/wp-stubs": "dev-main" + "php-stubs/wordpress-stubs": "~6.2.0", + "roots/wordpress-no-content": "~6.2.0" }, "autoload": { "psr-4": { diff --git a/package.json b/package.json index c0e7d97..8f393ad 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "@inpsyde/gutenberg-versions-mirror", - "version": "1.0.0", "description": "A lib that activate/deactivate a Gutenberg version depending on the Theme being activate", "main": "index.js", "repository": "git@github.com:inpsyde/gutenberg-versions-manager.git", @@ -10,6 +9,7 @@ "@wordpress/env": "^8.10.0" }, "scripts": { - "wp-env": "wp-env" + "wp-env:start": "wp-env start --environment=development", + "wp-env:stop": "wp-env stop" } } diff --git a/psalm.xml b/psalm.xml index 05a8e4c..ad06cf9 100644 --- a/psalm.xml +++ b/psalm.xml @@ -6,17 +6,23 @@ strictBinaryOperands="true" ignoreInternalFunctionFalseReturn="false" ignoreInternalFunctionNullReturn="false" + findUnusedCode="true" + findUnusedBaselineEntry="true" hideExternalErrors="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" > - + + + + + - + diff --git a/src/Provider/ServiceIntegration.php b/src/Provider/ServiceIntegration.php index 3e24f90..9cdf8bb 100644 --- a/src/Provider/ServiceIntegration.php +++ b/src/Provider/ServiceIntegration.php @@ -44,7 +44,7 @@ public function boot(App\Container $c): bool // phpcs:disable Inpsyde.CodeQuality.LineLength.TooLong if ($this->isGutenbergPluginActive()) { $this->notice->addNotice( - \__( + __( 'Gutenberg Version Manager cannot activate the Gutenberg plugin because a version of it is currently active. Please disable the Gutenberg plugin first.', 'gutenberg-versions-manager' ), diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 073aa88..1aa1018 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,17 +1,9 @@ - '', ], ], + 'theme-without-config-directory' => [], ], ]; diff --git a/tests/unit/Service/SupportedVersionsTest.php b/tests/unit/Service/SupportedVersionsTest.php index 7a591c6..ac29362 100644 --- a/tests/unit/Service/SupportedVersionsTest.php +++ b/tests/unit/Service/SupportedVersionsTest.php @@ -55,9 +55,9 @@ public function retrieve_empty_versions(): void } /** - * @test The `versions` entry does not exist and empty `versions` is returned + * @test Empty file content will still return an empty `versions` entry */ - public function return_empty_versions_entry_if_entry_does_not_exists(): void + public function return_empty_versions_entry_if_file_content_is_empty(): void { $this->theme ->shouldReceive('get_template_directory') @@ -70,13 +70,13 @@ public function return_empty_versions_entry_if_entry_does_not_exists(): void } /** - * @test Empty file content will still return an empty `versions` entry + * @test The config directory does not exists */ - public function return_empty_versions_entry_if_file_content_is_empty(): void + public function return_empty_versions_entry_if_config_directory_does_not_exists(): void { $this->theme ->shouldReceive('get_template_directory') - ->andReturn($this->themesPath('not-exists-versions-theme-name')); + ->andReturn($this->themesPath('theme-without-config-directory')); $supportedThemeVersions = Service\SupportedVersions::new(); $versions = $supportedThemeVersions->forTheme($this->theme);