Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
I have some doubts on these tests... what's the purpose of looping through
foreach (['field', 'filter', 'argument', 'sort'] as $handler_type) {
to have
$display->expects($this->atLeastOnce())
->method('setOption')
->with($this->anything(), [
? In the end, it will just pass if the method is only called once, but I suppose we expect at least to be called once per handler.
Proposed resolution
Fix the test so it makes sense.
Comment | File | Size | Author |
---|---|---|---|
#12 | 3103913-12.patch | 866 bytes | Lendude |
#4 | 3103913-4.patch | 4.34 KB | Lendude |
#4 | interdiff-3103913-3-4.txt | 2.47 KB | Lendude |
Comments
Comment #2
LendudeI think it should be testing per handler type, so something like this
Comment #3
LendudeNow without the auto formatting by PHPStorm....
Comment #4
LendudeAnd now with ViewExecutableTest::testAddHandler changed to the same logic
Comment #5
mondrakeLooks good to me.
Comment #9
catchCommitted 04722fb and pushed to 9.0.x. Thanks! Cherry-picked to 8.9.x and 8.8.x
Comment #10
mondrakeHuh, I think this fails in D8 when run under PHP 7.0, because the
syntax is not supported :(, it should remain
list($view, $display) = ...
.Sorry for missing that.
Comment #11
mondrakeComment #12
LendudeAh sorry :( part of the auto formatting by PHPStorm that I didn't catch either
Comment #13
mondrakeComment #14
xjmI believe this issue is causing failures on PHP 7.0... and you've a hotfix for me already. Thanks!
Comment #18
xjmCommitted the hotfix to 9.0.x, 8.9.x, and 8.8.x. (Technically 9.0.x does not need it since PHP 7.0 is not supported, but better to keep the branches in sync as much as possible.)
Thanks everyone!