diff --git a/.phive/phars.xml b/.phive/phars.xml index 1f56b2b..a6a3cbe 100644 --- a/.phive/phars.xml +++ b/.phive/phars.xml @@ -1,5 +1,5 @@ - - + + diff --git a/composer.json b/composer.json index 2482e5d..274e32e 100644 --- a/composer.json +++ b/composer.json @@ -30,10 +30,9 @@ "require-dev": { "cakephp/cakephp-codesniffer": "^5.0", "cakephp/debug_kit": "^5.0", - "cakephp/plugin-installer": "^1.3", "michelf/php-markdown": "^1.9", "mikey179/vfsstream": "^1.6.10", - "phpunit/phpunit": "^10.1.0" + "phpunit/phpunit": "^10.5.5 || ^11.1.3" }, "conflict": { "wyrihaximus/twig-view": "*" diff --git a/phpstan.neon b/phpstan.neon index fcfb25f..6feb634 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,9 +1,10 @@ parameters: level: 6 - checkMissingIterableValueType: false - checkGenericClassInNonGenericObjectType: false treatPhpDocTypesAsCertain: false bootstrapFiles: - tests/bootstrap.php paths: - src/ + ignoreErrors: + - + identifier: missingType.iterableValue diff --git a/tests/TestCase/Command/CompileCommandTest.php b/tests/TestCase/Command/CompileCommandTest.php index fd24ee1..eeec76e 100644 --- a/tests/TestCase/Command/CompileCommandTest.php +++ b/tests/TestCase/Command/CompileCommandTest.php @@ -39,6 +39,8 @@ public function setUp(): void Router::reload(); Configure::write('App.encoding', 'UTF-8'); + + $this->loadPlugins(['Cake/TwigView']); } /** @@ -85,7 +87,7 @@ public function testFile() */ public function testPlugin() { - $this->loadPlugins(['TestTwigView']); + $this->loadPlugins(['Cake/TwigView', 'TestTwigView']); $this->exec('twig-view compile plugin TestTwigView'); $this->assertExitSuccess(); diff --git a/tests/TestCase/Twig/Extension/StringsExtensionTest.php b/tests/TestCase/Twig/Extension/StringsExtensionTest.php index c5ea73b..b024df1 100644 --- a/tests/TestCase/Twig/Extension/StringsExtensionTest.php +++ b/tests/TestCase/Twig/Extension/StringsExtensionTest.php @@ -19,6 +19,7 @@ namespace Cake\TwigView\Test\TestCase\Twig\Extension; use Cake\TwigView\Twig\Extension\StringsExtension; +use Cake\Utility\Text; class StringsExtensionTest extends AbstractExtensionTest { @@ -98,7 +99,9 @@ public function testFilterTail() $input = 'Bob is 65 years old.'; $callable = $this->getFilter('tail')->getCallable(); $result = call_user_func_array($callable, [$input, 7]); - $this->assertSame('...old.', $result); + // Cake >= 5.1 '…s old.' + // Cake < 5.1 '...old.' + $this->assertSame(Text::tail($input, 7), $result); } public function testFilterTruncate() @@ -106,7 +109,9 @@ public function testFilterTruncate() $input = 'Bob is 65 years old.'; $callable = $this->getFilter('truncate')->getCallable(); $result = call_user_func_array($callable, [$input, 7]); - $this->assertSame('Bob ...', $result); + // Cake >= 5.1 'Bob is…' + // Cake < 5.1 'Bob ...' + $this->assertSame(Text::truncate($input, 7), $result); } public function testFilterExcerpt() @@ -114,7 +119,9 @@ public function testFilterExcerpt() $input = 'Bob is 65 years old.'; $callable = $this->getFilter('excerpt')->getCallable(); $result = call_user_func_array($callable, [$input, '65', 4]); - $this->assertSame('... is 65 yea...', $result); + // Cake >= 5.1 '… is 65 yea…' + // Cake < 5.1 '... is 65 yea...' + $this->assertSame(Text::excerpt($input, '65', 4), $result); } public function testFilterToList()