Commit f9c573a
authored
test(assertions): Simplify assertResultErrors to avoid closure serialization (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.1 parent 98a639a commit f9c573a
1 file changed
Lines changed: 9 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | 8 | | |
10 | 9 | | |
| |||
145 | 144 | | |
146 | 145 | | |
147 | 146 | | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | 147 | | |
154 | 148 | | |
155 | | - | |
156 | | - | |
157 | | - | |
| 149 | + | |
158 | 150 | | |
159 | 151 | | |
160 | 152 | | |
161 | | - | |
| 153 | + | |
| 154 | + | |
162 | 155 | | |
163 | 156 | | |
164 | | - | |
165 | | - | |
| 157 | + | |
| 158 | + | |
166 | 159 | | |
167 | 160 | | |
168 | 161 | | |
169 | | - | |
| 162 | + | |
170 | 163 | | |
171 | 164 | | |
172 | 165 | | |
173 | 166 | | |
174 | 167 | | |
175 | | - | |
| 168 | + | |
176 | 169 | | |
177 | 170 | | |
178 | 171 | | |
| |||
181 | 174 | | |
182 | 175 | | |
183 | 176 | | |
184 | | - | |
185 | | - | |
| 177 | + | |
| 178 | + | |
186 | 179 | | |
187 | 180 | | |
188 | 181 | | |
| |||
0 commit comments