Skip to content

Commit 5c6eec9

Browse files
MC-22156: [PageBuilder] Content in Category Pages Aligning to Browser Margin Instead of Body Content Margin
1 parent 5ebc4d7 commit 5c6eec9

File tree

1 file changed

+81
-0
lines changed
  • dev/tests/integration/testsuite/Magento/PageBuilder/Block/Catalog/Category

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\Catalog\Block\Category\View;
10+
11+
use Magento\Catalog\Api\CategoryRepositoryInterface;
12+
use Magento\Catalog\Block\Category\View;
13+
use Magento\Framework\Registry;
14+
use Magento\Framework\View\LayoutInterface;
15+
use Magento\TestFramework\Helper\Bootstrap;
16+
use Magento\Catalog\Api\Data\CategoryInterface;
17+
use Magento\Framework\ObjectManagerInterface;
18+
use PHPUnit\Framework\TestCase;
19+
20+
/**
21+
* @magentoAppArea frontend
22+
*/
23+
class ViewTest extends TestCase
24+
{
25+
/** @var ObjectManagerInterface */
26+
private $objectManager;
27+
28+
/** @var CategoryRepositoryInterface */
29+
private $categoryRepository;
30+
31+
/** @var View */
32+
private $block;
33+
34+
/** @var LayoutInterface */
35+
private $layout;
36+
37+
/** @var Registry */
38+
private $registry;
39+
40+
/**
41+
* @inheritdoc
42+
*/
43+
protected function setUp()
44+
{
45+
$this->objectManager = Bootstrap::getObjectManager();
46+
$this->categoryRepository = $this->objectManager->create(CategoryRepositoryInterface::class);
47+
$this->registry = $this->objectManager->get(Registry::class);
48+
$this->layout = $this->objectManager->get(LayoutInterface::class);
49+
}
50+
51+
/**
52+
* Check that PageBuilder category description block contents selector
53+
*
54+
* @return void
55+
* @magentoDataFixture Magento/Catalog/_files/category.php
56+
*/
57+
public function testDescription(): void
58+
{
59+
/** @var CategoryInterface $category */
60+
$category = $this->categoryRepository->get(333);
61+
$category->setDescription('This is the description for Category 333 without PageBuilder styles');
62+
$this->categoryRepository->save($category);
63+
$this->registerCategory($category);
64+
$this->block = $this->layout->createBlock(View::class);
65+
$this->block->setTemplate('Magento_PageBuilder::catalog/category/view/description.phtml');
66+
67+
$this->assertContains('data-appearance="contained"', $this->block->toHtml());
68+
}
69+
70+
/**
71+
* Register the category
72+
*
73+
* @param CategoryInterface $category
74+
* @return void
75+
*/
76+
private function registerCategory(CategoryInterface $category): void
77+
{
78+
$this->registry->unregister('current_category');
79+
$this->registry->register('current_category', $category);
80+
}
81+
}

0 commit comments

Comments
 (0)