Skip to content

Commit

Permalink
Merge pull request #10 from customgento/fix-integration-tests
Browse files Browse the repository at this point in the history
Fix integration tests
  • Loading branch information
sprankhub authored Sep 1, 2020
2 parents 2d96768 + 4dee664 commit 1427b10
Showing 1 changed file with 3 additions and 19 deletions.
22 changes: 3 additions & 19 deletions Test/Integration/AddScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,10 @@
namespace CustomGento\Cookiebot\Test\Integration\Plugin;

use CustomGento\Cookiebot\Model\ScriptGenerator;
use Magento\Catalog\Api\CategoryRepositoryInterface;
use Magento\Catalog\Api\ProductRepositoryInterface;
use Magento\TestFramework\TestCase\AbstractController;

class AddScriptTest extends AbstractController
{
/**
* @var ProductRepositoryInterface
*/
private $productRepository;

/**
* @var CategoryRepositoryInterface
*/
private $categoryRepository;

/**
* @var string
*/
Expand All @@ -29,9 +17,7 @@ class AddScriptTest extends AbstractController
protected function setUp()
{
parent::setUp();
$this->productRepository = $this->_objectManager->create(ProductRepositoryInterface::class);
$this->categoryRepository = $this->_objectManager->create(CategoryRepositoryInterface::class);
$this->script = $this->_objectManager->create(ScriptGenerator::class)->generate();
$this->script = $this->_objectManager->create(ScriptGenerator::class)->generate();
}

/**
Expand All @@ -51,8 +37,7 @@ public function testScriptAddedOnHomepage(): void
*/
public function testScriptAddedOnProductPage(): void
{
$product = $this->productRepository->get('simple');
$this->dispatch($product->getProductUrl());
$this->dispatch('/catalog/product/view/id/1');
self::assertContains($this->script, $this->getResponse()->getBody());
}

Expand All @@ -63,8 +48,7 @@ public function testScriptAddedOnProductPage(): void
*/
public function testScriptAddedOnCategoryPage(): void
{
$category = $this->categoryRepository->get('333');
$this->dispatch($category->getUrl());
$this->dispatch('/catalog/category/view/id/333');
self::assertContains($this->script, $this->getResponse()->getBody());
}

Expand Down

0 comments on commit 1427b10

Please sign in to comment.