Skip to content

Conversation

Kingdutch
Copy link
Contributor

This commit changes some loops into built-in PHP functions to simplify
the code and eliminate the need for closures.

Additionally this switches over to an assertEmpty from assertEquals.
This achieves the same test result and in the message still provides the
errors. However it prevents test failures with weird serialization
complaints that are caused by closures in function arguments of GraphQL
Error stacktraces. See sebastianbergmann/phpunit#4371 (comment)

The downside to this change is that we may lose some contextual
information that the full error in the array comparison may provide. The
upside is that we can actually see why tests fail since in a lot of
cases this beneficial diff doesn't make it into the test output anyway.
So all-in-all this is a step forward.

@Kingdutch Kingdutch force-pushed the bugfix/closure-serialization branch from 258989b to 0b19d10 Compare February 3, 2021 12:37
This commit changes some loops into built-in PHP functions to simplify
the code and eliminate the need for closures.

Additionally this switches over to an `assertEmpty` from `assertEquals`.
This achieves the same test result and in the message still provides the
errors. However it prevents test failures with weird serialization
complaints that are caused by closures in function arguments of GraphQL
Error stacktraces. See sebastianbergmann/phpunit#4371 (comment)

The downside to this change is that we may lose some contextual
information that the full error in the array comparison may provide. The
upside is that we can actually see why tests fail since in a lot of
cases this beneficial diff doesn't make it into the test output anyway.
So all-in-all this is a step forward.
@Kingdutch Kingdutch force-pushed the bugfix/closure-serialization branch from 0b19d10 to 3a98c22 Compare February 3, 2021 12:45
@klausi klausi merged commit f9c573a into drupal-graphql:8.x-4.x Feb 16, 2021
@klausi
Copy link
Contributor

klausi commented Feb 16, 2021

Thanks, makes sense to me!

@Kingdutch Kingdutch deleted the bugfix/closure-serialization branch February 17, 2021 12:56
klausi pushed a commit to klausi/graphql that referenced this pull request Sep 21, 2023
…ization (drupal-graphql#1159)

This commit changes some loops into built-in PHP functions to simplify
the code and eliminate the need for closures.

Additionally this switches over to an `assertEmpty` from `assertEquals`.
This achieves the same test result and in the message still provides the
errors. However it prevents test failures with weird serialization
complaints that are caused by closures in function arguments of GraphQL
Error stacktraces. See sebastianbergmann/phpunit#4371 (comment)

The downside to this change is that we may lose some contextual
information that the full error in the array comparison may provide. The
upside is that we can actually see why tests fail since in a lot of
cases this beneficial diff doesn't make it into the test output anyway.
So all-in-all this is a step forward.
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

Successfully merging this pull request may close these issues.

2 participants