EcomDev_PHPUnit icon indicating copy to clipboard operation
EcomDev_PHPUnit copied to clipboard

setCurrentStore not working when dispatch() a controllertest

Open sgrund opened this issue 12 years ago • 1 comments

$this->setCurrentStore('test_storeview'); $this->dispatch('/');

Will fall back to default storeview.

Problem is in \EcomDev_PHPUnit_Test_Case_Controller::getUrlModel when no _store param is given in arguments.

    if ($params['_store'] !== EcomDev_PHPUnit_Model_App::ADMIN_STORE_CODE) {
        $this->setCurrentStore($params['_store']);
        $urlModel = Mage::getModel('core/url');
    } else {
        ......
    }

There you should check if a store is already set by setCurrentStore() or don't call $this->setCurrentStore($params['_store']); if $params['_store'] is empty.

sgrund avatar Jun 17 '13 11:06 sgrund

Idea that you should be able to call setCurrentStore few times. Just specify _store argument for url, it is done specially for this purpose. setCurrentStore is more for model/block/helper tests.

IvanChepurnyi avatar Jun 17 '13 11:06 IvanChepurnyi