Skip to content

Commit 23024e4

Browse files
author
Serhii Bohomaz
committed
MC-39587: Create automated test for: "Add unexisting product to comparation list"
1 parent c716dcf commit 23024e4

File tree

1 file changed

+7
-6
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Controller/Product

1 file changed

+7
-6
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Controller/Product/CompareTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use Magento\TestFramework\TestCase\AbstractController;
1414
use Magento\Customer\Model\Session;
1515
use Magento\Customer\Model\Visitor;
16-
use Laminas\Stdlib\Parameters;
16+
use Laminas\Stdlib\ParametersFactory;
1717

1818
/**
1919
* Test compare product.
@@ -36,7 +36,7 @@ class CompareTest extends AbstractController
3636
/** @var Visitor */
3737
private $visitor;
3838

39-
/** @var Parameters */
39+
/** @var ParametersFactory */
4040
private $parameters;
4141

4242
/**
@@ -50,7 +50,7 @@ protected function setUp(): void
5050
$this->productRepository = $this->_objectManager->get(ProductRepository::class);
5151
$this->customerSession = $this->_objectManager->get(Session::class);
5252
$this->visitor = $this->_objectManager->get(Visitor::class);
53-
$this->parameters = $this->_objectManager->get(Parameters::class);
53+
$this->parameters = $this->_objectManager->get(ParametersFactory::class);
5454
}
5555

5656
/**
@@ -273,7 +273,7 @@ public function testAddNotExistingProductToCompareList(): void
273273
$this->getRequest()->setMethod(HttpRequest::METHOD_POST);
274274
$this->getRequest()->setParams(['product' => 787586534]);
275275
$this->dispatch('catalog/product_compare/add/');
276-
$this->assertSessionMessages($this->isEmpty(), MessageInterface::TYPE_ERROR);
276+
$this->assertSessionMessages($this->isEmpty());
277277
$this->_assertCompareListEquals([]);
278278
$this->assertRedirect($this->stringContains('not_existing'));
279279
}
@@ -285,8 +285,9 @@ public function testAddNotExistingProductToCompareList(): void
285285
*/
286286
private function prepareReferer(): void
287287
{
288-
$this->parameters->set('HTTP_REFERER', 'http://localhost/not_existing');
289-
$this->getRequest()->setServer($this->parameters);
288+
$parameters = $this->parameters->create();
289+
$parameters->set('HTTP_REFERER', 'http://localhost/not_existing');
290+
$this->getRequest()->setServer($parameters);
290291
}
291292

292293
/**

0 commit comments

Comments
 (0)