@@ -36,6 +36,9 @@ class CompareTest extends AbstractController
36
36
/** @var Visitor */
37
37
private $ visitor ;
38
38
39
+ /** @var Parameters */
40
+ private $ parameters ;
41
+
39
42
/**
40
43
* @inheritDoc
41
44
*/
@@ -47,6 +50,7 @@ protected function setUp(): void
47
50
$ this ->productRepository = $ this ->_objectManager ->get (ProductRepository::class);
48
51
$ this ->customerSession = $ this ->_objectManager ->get (Session::class);
49
52
$ this ->visitor = $ this ->_objectManager ->get (Visitor::class);
53
+ $ this ->parameters = $ this ->_objectManager ->get (Parameters::class);
50
54
}
51
55
52
56
/**
@@ -262,13 +266,14 @@ public function testRemoveActionProductNameXss(): void
262
266
* @magentoDataFixture Magento/Customer/_files/customer.php
263
267
* @return void
264
268
*/
265
- public function testAddNotExistingProductToCompactionList () : void
269
+ public function testAddNotExistingProductToCompareList () : void
266
270
{
267
271
$ this ->customerSession ->loginById (1 );
268
272
$ this ->prepareReferer ();
269
273
$ this ->getRequest ()->setMethod (HttpRequest::METHOD_POST );
270
274
$ this ->getRequest ()->setParams (['product ' => 787586534 ]);
271
275
$ this ->dispatch ('catalog/product_compare/add/ ' );
276
+ $ this ->assertSessionMessages ($ this ->isEmpty (), MessageInterface::TYPE_ERROR );
272
277
$ this ->_assertCompareListEquals ([]);
273
278
$ this ->assertRedirect ($ this ->stringContains ('not_existing ' ));
274
279
}
@@ -280,9 +285,8 @@ public function testAddNotExistingProductToCompactionList() : void
280
285
*/
281
286
private function prepareReferer (): void
282
287
{
283
- $ parameters = $ this ->_objectManager ->create (Parameters::class);
284
- $ parameters ->set ('HTTP_REFERER ' , 'http://localhost/not_existing ' );
285
- $ this ->getRequest ()->setServer ($ parameters );
288
+ $ this ->parameters ->set ('HTTP_REFERER ' , 'http://localhost/not_existing ' );
289
+ $ this ->getRequest ()->setServer ($ this ->parameters );
286
290
}
287
291
288
292
/**
0 commit comments