@@ -36,6 +36,9 @@ class CompareTest extends AbstractController
3636 /** @var Visitor */
3737 private $ visitor ;
3838
39+ /** @var Parameters */
40+ private $ parameters ;
41+
3942 /**
4043 * @inheritDoc
4144 */
@@ -47,6 +50,7 @@ protected function setUp(): void
4750 $ this ->productRepository = $ this ->_objectManager ->get (ProductRepository::class);
4851 $ this ->customerSession = $ this ->_objectManager ->get (Session::class);
4952 $ this ->visitor = $ this ->_objectManager ->get (Visitor::class);
53+ $ this ->parameters = $ this ->_objectManager ->get (Parameters::class);
5054 }
5155
5256 /**
@@ -262,13 +266,14 @@ public function testRemoveActionProductNameXss(): void
262266 * @magentoDataFixture Magento/Customer/_files/customer.php
263267 * @return void
264268 */
265- public function testAddNotExistingProductToCompactionList () : void
269+ public function testAddNotExistingProductToCompareList () : void
266270 {
267271 $ this ->customerSession ->loginById (1 );
268272 $ this ->prepareReferer ();
269273 $ this ->getRequest ()->setMethod (HttpRequest::METHOD_POST );
270274 $ this ->getRequest ()->setParams (['product ' => 787586534 ]);
271275 $ this ->dispatch ('catalog/product_compare/add/ ' );
276+ $ this ->assertSessionMessages ($ this ->isEmpty (), MessageInterface::TYPE_ERROR );
272277 $ this ->_assertCompareListEquals ([]);
273278 $ this ->assertRedirect ($ this ->stringContains ('not_existing ' ));
274279 }
@@ -280,9 +285,8 @@ public function testAddNotExistingProductToCompactionList() : void
280285 */
281286 private function prepareReferer (): void
282287 {
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 );
286290 }
287291
288292 /**
0 commit comments