EcomDev_PHPUnit icon indicating copy to clipboard operation
EcomDev_PHPUnit copied to clipboard

Problems when trying to test adminhtml config

Open schrodervictor opened this issue 10 years ago • 1 comments

Hi! I'm trying to write some tests for a custom admin module and one of the things I need to check is the menu item existence, but it seems that my adminhtml.xml are not being loaded inside the test cases.

This is what I tried so far:

<?php
class MyModule_Adminsample_Test_Config_Global extends EcomDev_PHPUnit_Test_Case_Config
{
    /* ... some tests ... */

    public function testAdminMenuPosition()
    {
        $this->assertConfigNodeHasChild('adminhtml/menu/catalog/children', 'mymodule_adminsample_index');
    }

    /* ... some other tests ... */
}

The XML is okay (the menu item is showing on the page, under the catalog menu as expected), I var_dump'ed the config and noticed that everything I have in any adminhtml.xml is not being loaded.

I also tried to force loading them using the following, without success:

$this->app()->getConfig()->loadModulesConfiguration('adminhtml.xml', $this->app()->getConfig());

Am I missing something here or is it really a bug/limitation?

Thanks for the attention!

schrodervictor avatar Jan 26 '15 17:01 schrodervictor

There is no way for now to test adminhtml.xml files.

IvanChepurnyi avatar Jan 26 '15 17:01 IvanChepurnyi