From cfdd682598e49398d6dbd485573359e171e7d9e7 Mon Sep 17 00:00:00 2001 From: mscherer Date: Fri, 15 Nov 2024 04:33:55 +0100 Subject: [PATCH] Fix tests. --- composer.json | 3 +-- .../TestCase/Generator/Task/PluginTaskTest.php | 4 ++++ .../Generator/Task/TranslationKeyTaskTest.php | 17 ++++++++++++++++- tests/test_files/meta/phpstorm/.meta.php | 14 ++++---------- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/composer.json b/composer.json index db7a87b8..116bcfc2 100644 --- a/composer.json +++ b/composer.json @@ -33,13 +33,12 @@ "require": { "php": ">=8.1", "cakephp/bake": "^3.0.4", - "cakephp/cakephp": "^5.0.0", + "cakephp/cakephp": "^5.0.7", "phpstan/phpdoc-parser": "^1.7", "sebastian/diff": "^5.0 || ^6.0", "squizlabs/php_codesniffer": "^3.7" }, "require-dev": { - "cakephp/cakephp": "^5.1.0", "dereuromark/cakephp-shim": "^3.3.0", "cakephp/migrations": "^4.0.1", "cakephp/plugin-installer": "^2.0.1", diff --git a/tests/TestCase/Generator/Task/PluginTaskTest.php b/tests/TestCase/Generator/Task/PluginTaskTest.php index 8b30a2e5..601d7aa6 100644 --- a/tests/TestCase/Generator/Task/PluginTaskTest.php +++ b/tests/TestCase/Generator/Task/PluginTaskTest.php @@ -2,6 +2,7 @@ namespace IdeHelper\Test\TestCase\Generator\Task; +use Cake\Core\Configure; use Cake\TestSuite\TestCase; use IdeHelper\Generator\Task\PluginTask; @@ -42,6 +43,9 @@ public function testCollect() { 'Migrations' => '\Cake\Http\BaseApplication::class', 'Shim' => '\Cake\Http\BaseApplication::class', ]; + if (version_compare(Configure::version(), '5.1.0', '<')) { + $expected = []; + } $this->assertSame($expected, $map); } diff --git a/tests/TestCase/Generator/Task/TranslationKeyTaskTest.php b/tests/TestCase/Generator/Task/TranslationKeyTaskTest.php index e8ccf983..536a4f34 100644 --- a/tests/TestCase/Generator/Task/TranslationKeyTaskTest.php +++ b/tests/TestCase/Generator/Task/TranslationKeyTaskTest.php @@ -71,7 +71,7 @@ public function testCollect() { return (string)$className; }, $list); - // 'my_plugin' is now superseeded by 'my_namespace/my_plugin' + // 'my_plugin' is now superseded by 'my_namespace/my_plugin' $expected = [ 'awesome' => '\'awesome\'', 'cake' => '\'cake\'', @@ -81,6 +81,21 @@ public function testCollect() { 'relations' => '\'relations\'', 'shim' => '\'shim\'', ]; + if (version_compare(Configure::version(), '5.1.0', '<')) { + $expected = [ + 'awesome' => '\'awesome\'', + 'bake' => '\'bake\'', + 'cake' => '\'cake\'', + 'cake/twig_view' => '\'cake/twig_view\'', + 'controllers' => '\'controllers\'', + 'ide_helper' => '\'ide_helper\'', + 'migrations' => '\'migrations\'', + 'my_namespace/my_plugin' => '\'my_namespace/my_plugin\'', + 'relations' => '\'relations\'', + 'shim' => '\'shim\'', + ]; + } + $this->assertSame($expected, $list); } diff --git a/tests/test_files/meta/phpstorm/.meta.php b/tests/test_files/meta/phpstorm/.meta.php index 6b7d4f20..1ff6500c 100644 --- a/tests/test_files/meta/phpstorm/.meta.php +++ b/tests/test_files/meta/phpstorm/.meta.php @@ -73,7 +73,6 @@ override( \Cake\Console\ConsoleIo::helper(0), map([ - 'Banner' => \Cake\Command\Helper\BannerHelper::class, 'Progress' => \Cake\Command\Helper\ProgressHelper::class, 'Table' => \Cake\Command\Helper\TableHelper::class, ]), @@ -88,6 +87,7 @@ 'My', 'MyController', 'MyOther', + 'RequestHandler', ); override( @@ -100,6 +100,7 @@ 'MyController' => \TestApp\Controller\Component\MyControllerComponent::class, 'MyNamespace/MyPlugin.My' => \MyNamespace\MyPlugin\Controller\Component\MyComponent::class, 'MyOther' => \TestApp\Controller\Component\MyOtherComponent::class, + 'Shim.RequestHandler' => \Shim\Controller\Component\RequestHandlerComponent::class, ]), ); @@ -148,10 +149,7 @@ override( \Cake\Core\PluginApplicationInterface::addPlugin(0), map([ - 'Bake' => \Cake\Http\BaseApplication::class, - 'Cake/TwigView' => \Cake\Http\BaseApplication::class, - 'Migrations' => \Cake\Http\BaseApplication::class, - 'Shim' => \Cake\Http\BaseApplication::class, + ]), ); @@ -1346,11 +1344,6 @@ 'Shim', 'Shim.deprecations', 'debug', - 'plugins', - 'plugins.Bake', - 'plugins.Cake/TwigView', - 'plugins.Migrations', - 'plugins.Shim', ); registerArgumentsSet( @@ -1421,6 +1414,7 @@ 'created', 'id', 'name', + 'params', ); registerArgumentsSet(