Example #1
0
 /**
  * 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));
 }
Example #2
0
 /**
  * Theme registration
  *
  * @param string $pathPattern
  * @return $this
  */
 public function register($pathPattern = '')
 {
     if (empty($pathPattern)) {
         $this->_themeCollection->addDefaultPattern('*');
     } else {
         $this->_themeCollection->addTargetPattern($pathPattern);
     }
     foreach ($this->_themeCollection as $theme) {
         $this->_registerThemeRecursively($theme);
     }
     $this->checkPhysicalThemes()->checkAllowedThemeRelations();
     return $this;
 }
Example #3
0
 public static function setUpBeforeClass()
 {
     $objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
     $objectManager->configure(array('preferences' => array('Magento\\Core\\Model\\Theme' => 'Magento\\Core\\Model\\Theme\\Data')));
     /** @var $fallbackPool \Magento\Framework\View\Design\Fallback\RulePool */
     $fallbackPool = $objectManager->get('Magento\\Framework\\View\\Design\\Fallback\\RulePool');
     self::$_fallbackRule = $fallbackPool->getRule(\Magento\Framework\View\Design\Fallback\RulePool::TYPE_STATIC_FILE);
     self::$_viewFilesFallback = $objectManager->get('Magento\\Framework\\View\\Design\\FileResolution\\Fallback\\StaticFile');
     self::$_filesFallback = $objectManager->get('Magento\\Framework\\View\\Design\\FileResolution\\Fallback\\File');
     // Themes to be checked
     self::$_themeCollection = $objectManager->get('Magento\\Core\\Model\\Theme\\Collection');
     self::$_themeCollection->addDefaultPattern('*');
     // Compose list of locales, needed to be checked for themes
     self::$_checkThemeLocales = array();
     foreach (self::$_themeCollection as $theme) {
         $themeLocales = self::_getThemeLocales($theme);
         $themeLocales[] = null;
         // Default non-localized file will need to be checked as well
         self::$_checkThemeLocales[$theme->getFullPath()] = $themeLocales;
     }
 }