Skip to content

Fix PHPUnit failures after Symfony/Twig/PHPUnit API changes#65

Open
azine wants to merge 3 commits into
codex/upgrade-to-php-8.5-and-symfony-7.4from
codex/fix-all-phpunit-test-errors
Open

Fix PHPUnit failures after Symfony/Twig/PHPUnit API changes#65
azine wants to merge 3 commits into
codex/upgrade-to-php-8.5-and-symfony-7.4from
codex/fix-all-phpunit-test-errors

Conversation

@azine
Copy link
Copy Markdown
Owner

@azine azine commented May 25, 2026

Motivation

  • Make the bundle and its tests compatible with newer Symfony/Twig/PHPUnit APIs and harden runtime behavior for edge cases.
  • Fix configuration definition issues that caused Symfony config tree validation failures when defaults and required flags conflicted.

Description

  • Remove erroneous isRequired() flags from azine_email.no_reply child nodes to avoid "cannot be required and have a default value" errors (changes in DependencyInjection/Configuration.php).
  • Replace legacy Twig filter and template APIs with modern equivalents by switching \Twig_SimpleFilter to \Twig\TwigFilter and using load() instead of loadTemplate() (changes in Services/AzineEmailTwigExtension.php and Services/AzineTwigSwiftMailer.php).
  • Harden AzineEmailTemplateController by validating image file existence before creating BinaryFileResponse, making spam-check parsing robust for empty/invalid JSON responses, and using $request->get('emailSource') to avoid accessing an uninitialized typed Request bag (changes in Controller/AzineEmailTemplateController.php).
  • Update PHPUnit tests for current PHPUnit/Twig behavior: use assertNotContains for array membership, update legacy Twig class references in tests, remove obsolete PHPUnit mock-object concrete typehint, change twig mock expectation from loadTemplate to load, and use createMock() for TokenStorageInterface in controller tests (changes under Tests/).

Testing

  • Attempted to run composer install but it failed due to a PHP runtime mismatch: project requires php:^8.5 while the environment provides php 8.4.22-dev, so dependencies could not be installed and PHPUnit could not be executed.
  • Because vendor dependencies were unavailable, vendor/bin/phpunit -c phpunit.xml.dist could not be run in this environment and automated test execution was not completed.
  • The modifications are focused on API compatibility and defensive checks; they should be verified by running composer install on a PHP >= 8.5 environment and then executing vendor/bin/phpunit -c phpunit.xml.dist.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant