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
No related merge requests found
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Drupal\FunctionalTests; namespace Drupal\FunctionalTests;
use Drupal\Tests\BrowserTestBase; use Drupal\Tests\BrowserTestBase;
use Behat\Mink\Exception\ExpectationException;
use Behat\Mink\Exception\ResponseTextException; use Behat\Mink\Exception\ResponseTextException;
use PHPUnit\Framework\AssertionFailedError; use PHPUnit\Framework\AssertionFailedError;
...@@ -20,7 +19,6 @@ class WebAssertTest extends BrowserTestBase { ...@@ -20,7 +19,6 @@ class WebAssertTest extends BrowserTestBase {
*/ */
protected static $modules = [ protected static $modules = [
'test_page_test', 'test_page_test',
'dblog',
]; ];
/** /**
...@@ -56,33 +54,6 @@ public function testResponseHeaderDoesNotExist() { ...@@ -56,33 +54,6 @@ public function testResponseHeaderDoesNotExist() {
$this->assertSession()->responseHeaderDoesNotExist('Null-Header'); $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 * @covers ::pageTextMatchesCount
*/ */
......
...@@ -58,13 +58,7 @@ protected function cleanUrl($url) { ...@@ -58,13 +58,7 @@ protected function cleanUrl($url) {
if (parse_url($url, PHP_URL_HOST) === NULL && strpos($url, '/') !== 0) { if (parse_url($url, PHP_URL_HOST) === NULL && strpos($url, '/') !== 0) {
$url = "/$url"; $url = "/$url";
} }
return parent::cleanUrl($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;
} }
/** /**
......
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