Skip to content

[Issue] Static properties serialization fix. #29313

Closed
@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #26175: Static properties serialization fix.


Description (*)

When test cleanup is disabled, Magento\TestFramework\Workaround\Cleanup\StaticProperties is caching static variables before the integration test starts, and restoring them after the test run is finished (if some instance of \Magento\TestFramework\TestCase\AbstractController has run).
Serialization and unserialization of static properties are provided by Magento\Framework\Serialize\Serializer\Json class, which wraps json_encode and json_decode functions.
Some of static properties are objects (e. g. \Magento\Framework\Autoload\AutoloaderRegistry::$autoloader). After encoding and decoding these properties through JSON we are getting arrays instead of objects. So we are facing issues on consecutive runs of integration tests.

Fixed Issues (if relevant)

  1. None

Manual testing scenarios (*)

  1. Disable the application cleanup in integration tests phpunit.xml:
    <const name="TESTS_CLEANUP" value="disabled"/>
  2. Run some controller integration test (e. g. \Magento\Newsletter\Controller\ManageTest)
  3. Run some another controller integration test (e. g. AdminNotification test bundle)

Questions or comments

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] Static properties serialization fix. #28319: Static properties serialization fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fixed in 2.4.xThe issue has been fixed in 2.4-develop branchIssue: Format is not validGate 1 Failed. Automatic verification of issue format is failedPriority: P3May be fixed according to the position in the backlog.Severity: S3Affects non-critical data or functionality and does not force users to employ a workaround.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions