/** * @magentoConfigFixture current_store web/unsecure/base_link_url http://example.com/ * @magentoConfigFixture admin_store web/unsecure/base_link_url http://example.com/ */ public function testStoreDirective() { $url = $this->_model->storeDirective(array('{{store direct_url="arbitrary_url/"}}', 'store', ' direct_url="arbitrary_url/"')); $this->assertStringMatchesFormat('http://example.com/%sarbitrary_url/', $url); $url = $this->_model->storeDirective(array('{{store url="translation/ajax/index"}}', 'store', ' url="translation/ajax/index"')); $this->assertStringMatchesFormat('http://example.com/%stranslation/ajax/index/', $url); $this->_model->setStoreId(0); $url = $this->_model->storeDirective(array('{{store url="translation/ajax/index"}}', 'store', ' url="translation/ajax/index"')); $this->assertStringMatchesFormat('http://example.com/index.php/backend/translation/ajax/index/%A', $url); }
/** * Ensures that the css directive will successfully compile and output contents of a LESS file, * as well as supporting loading files from a theme fallback structure. * * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoComponentsDir Magento/Email/Model/_files/design * @magentoAppIsolation enabled * @magentoDbIsolation enabled * @dataProvider cssDirectiveDataProvider * * @param int $templateType * @param string $directiveParams * @param string $expectedOutput */ public function testCssDirective($templateType, $directiveParams, $expectedOutput) { /** @var \Magento\Theme\Model\Theme\Registration $registration */ $registration = $this->objectManager->get('Magento\\Theme\\Model\\Theme\\Registration'); $registration->register(); $this->setUpDesignParams(); $this->model->setStoreId('fixturestore')->setPlainTemplateMode($templateType == TemplateTypesInterface::TYPE_TEXT); $output = $this->model->cssDirective(['{{css ' . $directiveParams . '}}', 'css', ' ' . $directiveParams]); if ($expectedOutput !== '') { $this->assertContains($expectedOutput, $output); } else { $this->assertSame($expectedOutput, $output); } }
/** * Ensures that the css directive will successfully compile and output contents of a LESS file, * as well as supporting loading files from a theme fallback structure. * * @magentoDataFixture Magento/Store/_files/core_fixturestore.php * @magentoDataFixture Magento/Email/Model/_files/design/themes.php * @magentoAppIsolation enabled * @dataProvider cssDirectiveDataProvider * * @param $directiveParams * @param $expectedOutput */ public function testCssDirective($directiveParams, $expectedOutput) { $this->setUpDesignParams(); $this->_model->setStoreId('fixturestore'); $this->assertContains($expectedOutput, $this->_model->cssDirective(['{{css ' . $directiveParams . '}}', 'css', ' ' . $directiveParams])); }