/** * Test if theme present in file system * * @magentoAppIsolation enabled * @covers \Magento\Theme\Model\Theme\Collection::hasTheme */ public function testHasThemeInCollection() { /** @var $themeModel \Magento\Framework\View\Design\ThemeInterface */ $themeModel = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create('Magento\\Framework\\View\\Design\\ThemeInterface'); $themeModel->setData(['area' => 'space_area', 'theme_title' => 'Space theme', '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->addConstraint(Collection::CONSTRAINT_AREA, Area::AREA_FRONTEND); $this->assertFalse($this->_model->hasTheme($themeModel)); }
/** * @param array $inputValues * @param array $expected * * @dataProvider addConstraintDataProvider */ public function testAddConstraint(array $inputValues, array $expected) { foreach ($inputValues as $data) { $type = $data[0]; $value = $data[1]; $this->model->addConstraint($type, $value); } $default = [Collection::CONSTRAINT_AREA => [], Collection::CONSTRAINT_VENDOR => [], Collection::CONSTRAINT_THEME_NAME => []]; $expected = array_merge($default, $expected); $this->assertAttributeSame($expected, 'constraints', $this->model); }