Skip to content

Commit 0f589e0

Browse files
committed
ACP2E-3350: Disabled Categories are no longer have their names grayed out in the category tree
1 parent 6ffd164 commit 0f589e0

File tree

1 file changed

+22
-6
lines changed
  • dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Category

1 file changed

+22
-6
lines changed

dev/tests/integration/testsuite/Magento/Catalog/Block/Adminhtml/Category/TreeBlockTest.php

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
use Magento\Framework\View\LayoutInterface;
1212
use Magento\TestFramework\Fixture\AppArea;
1313
use Magento\TestFramework\Fixture\DataFixture;
14+
use Magento\TestFramework\Fixture\DataFixtureStorage;
15+
use Magento\TestFramework\Fixture\DataFixtureStorageManager;
1416
use Magento\TestFramework\TestCase\AbstractBackendController;
1517

1618
/**
@@ -19,20 +21,34 @@
1921
class TreeBlockTest extends AbstractBackendController
2022
{
2123

24+
/**
25+
* @var DataFixtureStorage
26+
*/
27+
private $fixtures;
28+
29+
protected function setUp(): void
30+
{
31+
parent::setUp();
32+
$this->fixtures = $this->_objectManager->get(DataFixtureStorageManager::class)->getStorage();
33+
}
34+
2235
/**
2336
* Test disabled categories in the tree block.
2437
*/
2538
#[
2639
AppArea('adminhtml'),
27-
DataFixture(CategoryFixture::class, ['is_active' => false], as:'new_category'),
40+
DataFixture(CategoryFixture::class, as: 'c10'),
41+
DataFixture(CategoryFixture::class, ['parent_id' => '$c10.id$', 'is_active' => false], 'c11'),
2842
]
2943
public function testDisabledCategoriesHtml()
3044
{
31-
$this->dispatch("backend/catalog/category/index/");
32-
$this->assertEquals(200, $this->getResponse()->getHttpResponseCode());
45+
$category = $this->fixtures->get('c10');
3346
$layout = $this->_objectManager->get(LayoutInterface::class);
34-
$categoryTree = $layout->getBlock('category.tree');
35-
$blockHtml = $categoryTree->toHtml();
36-
$this->assertStringContainsString('no-active-category', $blockHtml);
47+
$categoryTreeBlock = $layout->createBlock(Tree::class);
48+
$categoryTreeArray = $categoryTreeBlock->getTree($category);
49+
$this->assertCount(1, $categoryTreeArray);
50+
$this->assertArrayHasKey('a_attr', $categoryTreeArray[0]);
51+
$this->assertArrayHasKey('class', $categoryTreeArray[0]['a_attr']);
52+
$this->assertStringContainsString('no-active-category', $categoryTreeArray[0]['a_attr']['class']);
3753
}
3854
}

0 commit comments

Comments
 (0)