diff --git a/CHANGELOG-2.x.md b/CHANGELOG-2.x.md index a1c3826..8dac351 100644 --- a/CHANGELOG-2.x.md +++ b/CHANGELOG-2.x.md @@ -3,11 +3,13 @@ ## v2.6.0 - Unreleased ### Added -- Twig ^v3.14 support - PHPUnit v11 support -### Removed -- PHPUnit v10 support +### Deprecated +- `DateFormatExtension` will be replaced by Twig date filter + +### Changed +- Twig v3.14 was set as the minimal supported version ## v2.5.0 - 2024-10-14 diff --git a/services.yaml b/services.yaml index ace5a96..5c27c5d 100644 --- a/services.yaml +++ b/services.yaml @@ -169,6 +169,10 @@ services: arguments: - '@OxidEsales\EshopCommunity\Internal\Transition\Adapter\TemplateLogic\DateFormatHelper' tags: ['twig.extension'] + deprecated: + package: 'oxid-esales/twig-component' + version: '2.6.0' + message: 'The "%service_id%" service is deprecated.' OxidEsales\Twig\Extensions\Filters\TranslateExtension: arguments: diff --git a/src/Extensions/Filters/DateFormatExtension.php b/src/Extensions/Filters/DateFormatExtension.php index ffce166..e4f678c 100644 --- a/src/Extensions/Filters/DateFormatExtension.php +++ b/src/Extensions/Filters/DateFormatExtension.php @@ -13,6 +13,9 @@ use Twig\Extension\AbstractExtension; use Twig\TwigFilter; +/** + * @deprecated will be removed in next major version, use Twig's date filter instead + */ class DateFormatExtension extends AbstractExtension { public function __construct(private DateFormatHelper $dateFormatHelper) diff --git a/tests/Integration/Extensions/IncludeContentExtensionTest.php b/tests/Integration/Extensions/IncludeContentExtensionTest.php index d49be6c..4bef174 100644 --- a/tests/Integration/Extensions/IncludeContentExtensionTest.php +++ b/tests/Integration/Extensions/IncludeContentExtensionTest.php @@ -63,13 +63,13 @@ protected function setUp(): void $contentFactoryMock ->method('getContent') - ->will($this->returnValueMap([ + ->willReturnMap([ ['ident', 'german', $deContentMock], ['ident', 'english', $enContentMock], ['ident', 'twig_code', $twigContentMock], ['ident', 'dynamic_content', $dynamicContentMock], ['ident', 'not_active', $notActiveContentMock] - ])); + ]); $this->extension = new IncludeContentExtension($contentFactoryMock); } diff --git a/tests/Integration/TwigEngine/TemplateChain/ModulesTemplateChainTest.php b/tests/Integration/TwigEngine/TemplateChain/ModulesTemplateChainTest.php index b06eaff..7696e47 100644 --- a/tests/Integration/TwigEngine/TemplateChain/ModulesTemplateChainTest.php +++ b/tests/Integration/TwigEngine/TemplateChain/ModulesTemplateChainTest.php @@ -13,10 +13,11 @@ use OxidEsales\EshopCommunity\Tests\ContainerTrait; use OxidEsales\Twig\Resolver\TemplateChain\TemplateNotInChainException; use OxidEsales\Twig\Tests\Integration\TestingFixturesTrait; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use PHPUnit\Framework\TestCase; use Twig\Error\LoaderError; -/** @runTestsInSeparateProcesses */ +#[RunTestsInSeparateProcesses] final class ModulesTemplateChainTest extends TestCase { use ContainerTrait; diff --git a/tests/Integration/TwigEngine/TemplateChainSorting/ModulesTemplateChainSortingTest.php b/tests/Integration/TwigEngine/TemplateChainSorting/ModulesTemplateChainSortingTest.php index 7ed9c61..2668d49 100644 --- a/tests/Integration/TwigEngine/TemplateChainSorting/ModulesTemplateChainSortingTest.php +++ b/tests/Integration/TwigEngine/TemplateChainSorting/ModulesTemplateChainSortingTest.php @@ -15,9 +15,10 @@ use OxidEsales\EshopCommunity\Tests\ContainerTrait; use OxidEsales\Twig\Tests\Integration\TestingFixturesTrait; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use PHPUnit\Framework\TestCase; -/** @runTestsInSeparateProcesses */ +#[RunTestsInSeparateProcesses] final class ModulesTemplateChainSortingTest extends TestCase { use ContainerTrait; diff --git a/tests/Integration/TwigEngine/ThemeInheritance/ShopTemplateDirectoryResolvingTest.php b/tests/Integration/TwigEngine/ThemeInheritance/ShopTemplateDirectoryResolvingTest.php index 915db7e..9016fe7 100644 --- a/tests/Integration/TwigEngine/ThemeInheritance/ShopTemplateDirectoryResolvingTest.php +++ b/tests/Integration/TwigEngine/ThemeInheritance/ShopTemplateDirectoryResolvingTest.php @@ -12,11 +12,10 @@ use OxidEsales\EshopCommunity\Internal\Framework\Templating\TemplateEngineInterface; use OxidEsales\EshopCommunity\Tests\ContainerTrait; use OxidEsales\Twig\Tests\Integration\TestingFixturesTrait; +use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; use PHPUnit\Framework\TestCase; -/** - * @runTestsInSeparateProcesses - */ +#[RunTestsInSeparateProcesses] final class ShopTemplateDirectoryResolvingTest extends TestCase { use ContainerTrait; diff --git a/tests/Unit/Extensions/Filters/DateFormatExtensionTest.php b/tests/Unit/Extensions/Filters/DateFormatExtensionTest.php index b51a9fc..414a2c2 100644 --- a/tests/Unit/Extensions/Filters/DateFormatExtensionTest.php +++ b/tests/Unit/Extensions/Filters/DateFormatExtensionTest.php @@ -12,6 +12,7 @@ use OxidEsales\EshopCommunity\Internal\Transition\Adapter\TemplateLogic\DateFormatHelper; use OxidEsales\Twig\Extensions\Filters\DateFormatExtension; use PHPUnit\Framework\Attributes\DataProvider; +use PHPUnit\Framework\Attributes\IgnoreDeprecations; use PHPUnit\Framework\TestCase; final class DateFormatExtensionTest extends TestCase @@ -49,6 +50,7 @@ public static function provider(): array } #[DataProvider('provider')] + #[IgnoreDeprecations] public function testDateFormat($string, $format, $default_date, $expectedDate): void { $actualDate = $this->dateFormatExtension->dateFormat($string, $format, $default_date); diff --git a/tests/Unit/Loader/CmsLoaderTest.php b/tests/Unit/Loader/CmsLoaderTest.php index f4a3536..d312f45 100644 --- a/tests/Unit/Loader/CmsLoaderTest.php +++ b/tests/Unit/Loader/CmsLoaderTest.php @@ -61,16 +61,14 @@ public function setUp(): void $contentFactoryMock ->method('getContent') - ->will( - $this->returnValueMap( - [ - ['ident', 'valid', $validContentMock], - ['oxid', 'english', $englishContentMock], - ['ident', 'field', $fieldContentMock], - ['oxid', 'notFresh', $notFreshContentMock], - ['ident', 'notValid', $notValidContentMock] - ] - ) + ->willReturnMap( + [ + ['ident', 'valid', $validContentMock], + ['oxid', 'english', $englishContentMock], + ['ident', 'field', $fieldContentMock], + ['oxid', 'notFresh', $notFreshContentMock], + ['ident', 'notValid', $notValidContentMock] + ] ); /** @var ContentFactory $contentFactoryMock */