EcomDev_PHPUnit icon indicating copy to clipboard operation
EcomDev_PHPUnit copied to clipboard

Category fixture not in Mage_Catalog_Model_Resource_Tree

Open ScreamingDev opened this issue 11 years ago • 0 comments

Situation

Got this fixture:

eav:
  catalog_category:
    - entity_id: 21
      parent_id: 2
      path: 1/2/21
      name: Common
      level: 2
      children_count: 0
      is_active: 1
      /stores:
        - 0
        - 1

Running tests on adminhtml/catalog/category/edit

Problem

app/code/core/Mage/Adminhtml/Block/Catalog/Category/Abstract.php:109

if ($this->getCategory()) {
                $tree->loadEnsuredNodes($this->getCategory(), $tree->getNodeById($rootId));
            }

The $tree->getNodeById($rootId) is null but it shouldn't. The Varien_Data_Tree_Node_Collection is empty. Mage::app()->getStore()->getId() at that point is 0 / admin.

Solution

  • what did I get wrong?
  • where do these nodes come from?
  • maybe mock it and provide the fixture information

ScreamingDev avatar Oct 11 '13 18:10 ScreamingDev