Skip to content

Commit

Permalink
Fix prefer lowest check (#361)
Browse files Browse the repository at this point in the history
* Fix tests.
  • Loading branch information
dereuromark authored Nov 15, 2024
1 parent bf7ee8a commit d2b4fdd
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 17 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ jobs:
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}
then
composer update --prefer-lowest --prefer-stable
composer lowest-setup
else
composer install --no-progress --prefer-dist --optimize-autoloader
fi
if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then composer lowest-setup; fi
- name: Run PHPUnit
run: |
Expand All @@ -77,7 +77,8 @@ jobs:
fi
- name: Validate prefer-lowest
run: if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then vendor/bin/validate-prefer-lowest -m; fi
if: matrix.prefer-lowest == 'prefer-lowest'
run: vendor/bin/validate-prefer-lowest -m

- name: Upload coverage reports to Codecov
if: success() && matrix.php-version == '8.1'
Expand Down
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@
"require": {
"php": ">=8.1",
"cakephp/bake": "^3.0.4",
"cakephp/cakephp": "^5.0.0",
"phpstan/phpdoc-parser": "^1.7",
"cakephp/cakephp": "^5.0.7",
"phpstan/phpdoc-parser": "^1.23.1",
"sebastian/diff": "^5.0 || ^6.0",
"squizlabs/php_codesniffer": "^3.7"
"squizlabs/php_codesniffer": "^3.8"
},
"require-dev": {
"cakephp/cakephp": "^5.1.0",
"dereuromark/cakephp-shim": "^3.3.0",
"cakephp/migrations": "^4.0.1",
"cakephp/plugin-installer": "^2.0.1",
Expand Down
4 changes: 4 additions & 0 deletions tests/TestCase/Generator/Task/PluginTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace IdeHelper\Test\TestCase\Generator\Task;

use Cake\Core\Configure;
use Cake\TestSuite\TestCase;
use IdeHelper\Generator\Task\PluginTask;

Expand Down Expand Up @@ -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);
}

Expand Down
17 changes: 16 additions & 1 deletion tests/TestCase/Generator/Task/TranslationKeyTaskTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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\'',
Expand All @@ -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);
}

Expand Down
14 changes: 4 additions & 10 deletions tests/test_files/meta/phpstorm/.meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]),
Expand All @@ -88,6 +87,7 @@
'My',
'MyController',
'MyOther',
'RequestHandler',
);

override(
Expand All @@ -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,
]),
);

Expand Down Expand Up @@ -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,

]),
);

Expand Down Expand Up @@ -1346,11 +1344,6 @@
'Shim',
'Shim.deprecations',
'debug',
'plugins',
'plugins.Bake',
'plugins.Cake/TwigView',
'plugins.Migrations',
'plugins.Shim',
);

registerArgumentsSet(
Expand Down Expand Up @@ -1421,6 +1414,7 @@
'created',
'id',
'name',
'params',
);

registerArgumentsSet(
Expand Down

0 comments on commit d2b4fdd

Please sign in to comment.