Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JsonException] Non-backed enums have no default serialization #6753

Open
innerfly opened this issue Apr 26, 2024 · 0 comments
Open

[JsonException] Non-backed enums have no default serialization #6753

innerfly opened this issue Apr 26, 2024 · 0 comments

Comments

@innerfly
Copy link

What are you trying to achieve?

Run test with dataprovider wich contains non-backed enum

What do you get instead?

When run unit tests and some test is fail, console output get an extra exception in addition to main error:

[JsonException] Non-backed enums have no default serialization

I have explored this and found that exception is thrown for test with dataprovider, contained non-backed enums in example case. When run separately, this test works correctly.
I have debuged PHPUnit and then Codecepton and found place where exception is thow: it is json_encode() call in \Codeception\Test\Descriptor::getTestSignatureUnique() class. When json_encode() try to serialize non-backed enum wich is not serializable, it thows such exception. I assume there should be added checking if example data is serializable.

Details

  • Codeception version: 5.1.2
  • PHP Version: 8.2.18
  • Operating System: Ubuntu 20.04.6 LTS
  • Installation type: Composer
  • Suite configuration:
actor: UnitTester
bootstrap: _bootstrap.php
modules:
    enabled:
        - Mockery
        - \App\Tests\Helper\SymfonyHelper:
              app_path: 'src'
              environment: 'test'
              debug: false
              rebootable_client: false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant