Skip to content

Commit 08729c1

Browse files
committed
MAGETWO-96663: UrlRewrite removes query string from url, if url has trailing slash
1 parent 37e620e commit 08729c1

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

dev/tests/integration/testsuite/Magento/UrlRewrite/Controller/UrlRewriteTest.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class UrlRewriteTest extends AbstractController
1212
{
1313
/**
1414
* @magentoDataFixture Magento/UrlRewrite/_files/url_rewrite.php
15-
* @magentoAppIsolation enabled
1615
*
1716
* @covers \Magento\UrlRewrite\Controller\Router::match
1817
* @covers \Magento\UrlRewrite\Model\Storage\DbStorage::doFindOneByData
@@ -32,14 +31,16 @@ public function testMatchUrlRewrite(
3231
/** @var HttpResponse $response */
3332
$response = $this->getResponse();
3433
$code = $response->getHttpResponseCode();
35-
$location = $response->getHeader('Location')->getFieldValue();
36-
3734
$this->assertEquals($expectedCode, $code, 'Invalid response code');
38-
$this->assertStringEndsWith(
39-
$redirect,
40-
$location,
41-
'Invalid location header'
42-
);
35+
36+
if ($expectedCode !== 200) {
37+
$location = $response->getHeader('Location')->getFieldValue();
38+
$this->assertStringEndsWith(
39+
$redirect,
40+
$location,
41+
'Invalid location header'
42+
);
43+
}
4344
}
4445

4546
/**
@@ -72,6 +73,11 @@ public function requestDataProvider()
7273
'request' => '/page-similar/',
7374
'redirect' => '/page-b',
7475
],
76+
'Use Case #7: Request with query params' => [
77+
'request' => '/enable-cookies/?test-param',
78+
'redirect' => '',
79+
200,
80+
],
7581
];
7682
}
7783
}

dev/tests/integration/testsuite/Magento/UrlRewrite/_files/url_rewrite_rollback.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
$collection = $urlRewriteCollection
2222
->addFieldToFilter('entity_type', 'custom')
2323
->addFieldToFilter('request_path', ['page-a', 'page-b', 'page-c'])
24-
->addFieldToFilter('entity_id', '333')
2524
->load()
2625
->walk('delete');
2726

0 commit comments

Comments
 (0)