/** * @covers Mage_Core_Model_Theme_Service::assignThemeToStores * @expectedException UnexpectedValueException * @expectedExceptionMessage Theme is not recognized. Requested id: -1 */ public function testAssignThemeToStoresWrongThemeId() { /** @var $themeMock Mage_Core_Model_Theme */ $themeMock = $this->getMock('Mage_Core_Model_Theme', array('load', 'getId'), array(), '', false); $themeMock->expects($this->once())->method('load')->with($this->equalTo(-1))->will($this->returnValue($themeMock)); $themeMock->expects($this->once())->method('getId')->will($this->returnValue(false)); $themeFactoryMock = $this->getMock('Mage_Core_Model_Theme_Factory', array('create'), array(), '', false); $themeFactoryMock->expects($this->any())->method('create')->will($this->returnValue($themeMock)); $themeService = new Mage_Core_Model_Theme_Service($themeFactoryMock, $this->getMock('Mage_Core_Model_Design_Package', array(), array(), '', false), $this->getMock('Mage_Core_Model_App', array(), array(), '', false), $this->getMock('Mage_Core_Helper_Data', array(), array(), '', false), $this->getMock('Mage_DesignEditor_Model_Resource_Layout_Update', array(), array(), '', false), $this->getMock('Mage_Core_Model_Event_Manager', array(), array(), '', false)); $themeService->assignThemeToStores(-1); }
/** * Get the flag if there are multiple store-views in Magento * * @return bool */ protected function _isMultipleStoreViewMode() { $isMultipleMode = false; $tmpStore = null; foreach ($this->_serviceModel->getStoresByThemes() as $stores) { /** @var $store Mage_Core_Model_Store */ foreach ($stores as $store) { if ($tmpStore === null) { $tmpStore = $store->getId(); } elseif ($tmpStore != $store->getId()) { $isMultipleMode = true; break 2; } } } return $isMultipleMode; }