7
7
8
8
namespace Magento \UrlRewrite \Controller ;
9
9
10
- use Magento \Catalog \Api \CategoryRepositoryInterface ;
11
10
use Magento \TestFramework \TestCase \AbstractController ;
12
11
use Magento \Framework \App \Response \Http as HttpResponse ;
13
- use Zend \Http \Response ;
14
12
15
13
/**
16
14
* Class to test Match corresponding URL Rewrite
17
15
*/
18
16
class UrlRewriteTest extends AbstractController
19
17
{
20
- /** @var CategoryRepositoryInterface */
21
- private $ categoryRepository ;
22
-
23
- /**
24
- * @inheritdoc
25
- */
26
- protected function setUp ()
27
- {
28
- parent ::setUp ();
29
-
30
- $ this ->categoryRepository = $ this ->_objectManager ->get (CategoryRepositoryInterface::class);
31
- }
32
-
33
18
/**
34
19
* @magentoDataFixture Magento/UrlRewrite/_files/url_rewrite.php
35
20
* @magentoDbIsolation disabled
@@ -47,15 +32,15 @@ protected function setUp()
47
32
public function testMatchUrlRewrite (
48
33
string $ request ,
49
34
string $ redirect ,
50
- int $ expectedCode = Response ::STATUS_CODE_301
35
+ int $ expectedCode = HttpResponse ::STATUS_CODE_301
51
36
): void {
52
37
$ this ->dispatch ($ request );
53
38
/** @var HttpResponse $response */
54
39
$ response = $ this ->getResponse ();
55
40
$ code = $ response ->getHttpResponseCode ();
56
41
$ this ->assertEquals ($ expectedCode , $ code , 'Invalid response code ' );
57
42
58
- if ($ expectedCode !== Response ::STATUS_CODE_200 ) {
43
+ if ($ expectedCode !== HttpResponse ::STATUS_CODE_200 ) {
59
44
$ location = $ response ->getHeader ('Location ' )->getFieldValue ();
60
45
$ this ->assertStringEndsWith (
61
46
$ redirect ,
@@ -98,7 +83,7 @@ public function requestDataProvider(): array
98
83
'Use Case #7: Request with query params ' => [
99
84
'request ' => '/enable-cookies/?test-param ' ,
100
85
'redirect ' => '' ,
101
- Response ::STATUS_CODE_200 ,
86
+ HttpResponse ::STATUS_CODE_200 ,
102
87
],
103
88
];
104
89
}
@@ -116,7 +101,7 @@ public function testCategoryUrlRewrite(string $request): void
116
101
$ this ->dispatch ($ request );
117
102
$ response = $ this ->getResponse ();
118
103
$ this ->assertEquals (
119
- Response ::STATUS_CODE_200 ,
104
+ HttpResponse ::STATUS_CODE_200 ,
120
105
$ response ->getHttpResponseCode (),
121
106
'Response code does not match expected value '
122
107
);
0 commit comments