Commit 924fe924 authored by catch's avatar catch

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
......@@ -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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment