EcomDev_PHPUnit
EcomDev_PHPUnit copied to clipboard
setCurrentStore not working when dispatch() a controllertest
$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.
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.