https://www.drupal.org/pift-ci-job/2374991

1) Drupal\Tests\facets_form_date_range\Functional\DateRangeIntegrationTest::testDateRangeDateOnly
Behat\Mink\Exception\ExpectationException: Current page is "/test?f%5B0%5D=authored_on%3A2021-08-16~", but "/test?f[0]=authored_on%3A2021-08-16~" expected.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

donquixote created an issue. See original summary.

donquixote’s picture

Status: Active » Needs review
StatusFileSize
new6.87 KB
donquixote’s picture

Code style fix.

Status: Needs review » Needs work

The last submitted patch, 3: facets_form-1.x-3280015-3-FacetUrlTestTrait.patch, failed testing. View results

donquixote’s picture

The tests in facets module all use Url::fromUserInput() to test facet urls.
So I am doing the same here, but with a helper method for convenience.

One thing I am not sure about is IntegrationTest::assertCurrentUrl().

  protected function assertCurrentUrl(string $expected_url): void {
    // Check first the path & the fragment.
    $this->assertSession()->addressEquals($expected_url);
    // Compare also the query strings as arrays but allow different order.
    $expected_query = $this->normalizeQueryString($expected_url);
    $actual_query = $this->normalizeQueryString($this->getSession()->getCurrentUrl());
    $this->assertEquals($expected_query, $actual_query);
  }

For some reason there is no complaining about url-encoded square brackets here.

Also the part after $this->assertSession()->addressEquals($expected_url); seems weird: If query parts are in different order, wouldn't this already cause the previous assertion to fail?

donquixote’s picture

So the actual problem was this: #3164686: WebAssert::addressEquals() and AssertLegacyTrait::assertUrl() fail to check the querystring

With Drupal 9.2.*, the tests would pass because the query string was ignored in the assertions.

With Drupal 9.3.*, the tests fail because of urlencode, and because some of them actually had wrong expectations.

donquixote’s picture

Status: Needs work » Needs review

Andras_Szilagyi made their first commit to this issue’s fork.

andras_szilagyi’s picture

Status: Needs review » Fixed

merged, thx

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.