コード例 #1
0
ファイル: CollectionTest.php プロジェクト: aiesh/magento2
 /**
  * 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));
 }
コード例 #2
0
ファイル: Registration.php プロジェクト: aiesh/magento2
 /**
  * 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;
 }
コード例 #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;
     }
 }