/** * Test is theme present in file system * * @magentoAppIsolation enabled * @covers \Magento\Core\Model\Theme\Collection::hasTheme * @magentoAppArea install */ public function testHasThemeInCollection() { /** @var $themeModel \Magento\Framework\View\Design\ThemeInterface */ $themeModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\ThemeInterface'); $themeModel->setData(array('area' => 'space_area', 'theme_title' => 'Space theme', 'theme_version' => '0.1.0', 'parent_id' => null, 'is_featured' => false, 'theme_path' => 'default_space', 'preview_image' => 'images/preview.png', 'type' => \Magento\Framework\View\Design\ThemeInterface::TYPE_PHYSICAL)); $this->_model->addDefaultPattern('*'); $this->assertFalse($this->_model->hasTheme($themeModel)); }
/** * Checks all physical themes that they were not deleted * * @return $this */ public function checkPhysicalThemes() { $themes = $this->_collectionFactory->create()->addTypeFilter(ThemeInterface::TYPE_PHYSICAL); /** @var $theme ThemeInterface */ foreach ($themes as $theme) { if (!$this->_themeCollection->hasTheme($theme)) { $theme->setType(ThemeInterface::TYPE_VIRTUAL)->save(); } } return $this; }