Skip to content
Snippets Groups Projects
Commit 924fe924 authored by catch's avatar catch
Browse files

Issue #3164686 by mondrake, longwave, ridhimaabrol24, alexpott, larowlan:...

Issue #3164686 by mondrake, longwave, ridhimaabrol24, alexpott, larowlan: WebAssert::addressEquals() and AssertLegacyTrait::assertUrl() fail to check the querystring
parent dcd44643
No related branches found
No related tags found
7 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1012Issue #3226887: Hreflang on non-canonical content pages,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10,!596Issue #3046532: deleting an entity reference field, used in a contextual view, makes the whole site unrecoverable,!496Issue #2463967: Use .user.ini file for PHP settings,!144Issue #2666286: Clean up menu_ui to conform to Drupal coding standards,!16Draft: Resolve #2081585 "History storage"
......@@ -3,7 +3,6 @@
namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase;
use Behat\Mink\Exception\ExpectationException;
use Behat\Mink\Exception\ResponseTextException;
use PHPUnit\Framework\AssertionFailedError;
......@@ -20,7 +19,6 @@ class WebAssertTest extends BrowserTestBase {
*/
protected static $modules = [
'test_page_test',
'dblog',
];
/**
......@@ -56,33 +54,6 @@ public function testResponseHeaderDoesNotExist() {
$this->assertSession()->responseHeaderDoesNotExist('Null-Header');
}
/**
* Tests that addressEquals distinguishes querystrings.
*
* @covers ::addressEquals
*/
public function testAddressEqualsDistinguishesQuerystrings() {
// Insert 300 log messages.
$logger = $this->container->get('logger.factory')->get('pager_test');
for ($i = 0; $i < 300; $i++) {
$logger->debug($this->randomString());
}
// Get to the db log report.
$this->drupalLogin($this->drupalCreateUser([
'access site reports',
]));
$this->drupalGet('admin/reports/dblog');
$this->assertSession()->addressEquals('admin/reports/dblog');
// Go to the second page, we expect the querystring to change to '?page=1'.
$this->drupalGet('admin/reports/dblog', ['query' => ['page' => 1]]);
$this->assertSession()->addressEquals('admin/reports/dblog?page=1');
$this->expectException(ExpectationException::class);
$this->expectExceptionMessage('Current page is "/admin/reports/dblog?page=1", but "/admin/reports/dblog" expected.');
$this->assertSession()->addressEquals('admin/reports/dblog');
}
/**
* @covers ::pageTextMatchesCount
*/
......
......@@ -58,13 +58,7 @@ protected function cleanUrl($url) {
if (parse_url($url, PHP_URL_HOST) === NULL && strpos($url, '/') !== 0) {
$url = "/$url";
}
$parts = parse_url($url);
$fragment = empty($parts['fragment']) ? '' : '#' . $parts['fragment'];
$query = empty($parts['query']) ? '' : '?' . $parts['query'];
$path = empty($parts['path']) ? '/' : $parts['path'];
return preg_replace('/^\/[^\.\/]+\.php\//', '/', $path) . $query . $fragment;
return parent::cleanUrl($url);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment