/** * Test for method \Magento\UrlRewrite\Block\Catalog\Category\Tree::getTreeArray() * @magentoAppIsolation enabled * @magentoDataFixture Magento/Catalog/_files/indexer_catalog_category.php */ public function testGetTreeArray() { $tree = $this->_treeBlock->getTreeArray(); $this->assertEquals(false, $tree['is_active']); $this->assertEquals('Root', (string) $tree['name']); $this->assertEquals(true, $tree['expanded']); $this->assertCount(1, $tree['children']); }
/** * Test for method \Magento\UrlRewrite\Block\Catalog\Category\Tree::getTreeArray() */ public function testGetTreeArray() { $expectedTreeArray = ['id' => 1, 'parent_id' => 0, 'children_count' => 1, 'is_active' => false, 'name' => 'Root', 'level' => 0, 'product_count' => 0, 'children' => [['id' => 2, 'parent_id' => \Magento\Catalog\Model\Category::TREE_ROOT_ID, 'children_count' => 0, 'is_active' => true, 'name' => 'Default Category', 'level' => 1, 'product_count' => 0, 'cls' => 'active-category', 'expanded' => false, 'disabled' => true]], 'cls' => 'no-active-category', 'expanded' => true]; $this->assertEquals($expectedTreeArray, $this->_treeBlock->getTreeArray(), 'Tree array is invalid'); }