Skip to content

Commit

Permalink
Merge pull request #399 from magento-frontend/Kanban-2-PR-2.2
Browse files Browse the repository at this point in the history
Bugs
MAGETWO-56915 Versioning of static files (CSS, JS, Fonts, Images, etc.) doesn't enabled by default - for mainline
MAGETWO-58367 Pattern in elements.xsd is too strict [GITHUB PR#6283]
MAGETWO-58371 Use inline elements for inline links [GITHUB PR#1988]
  • Loading branch information
VladimirZaets authored Sep 19, 2016
2 parents 52c4963 + 3a2023f commit 2842e92
Show file tree
Hide file tree
Showing 14 changed files with 47 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

// @codingStandardsIgnoreFile
?>
<div class="widget block block-product-link-inline">
<span class="widget block block-product-link-inline">
<a <?php /* @escapeNotVerified */ echo $block->getLinkAttributes() ?>><span><?php echo $block->escapeHtml($block->getLabel()) ?></span></a>
</div>
</span>
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
* See COPYING.txt for license details.
*/
?>
<div class="widget block block-cms-link-inline">
<span class="widget block block-cms-link-inline">
<a <?php /* @escapeNotVerified */ echo $block->getLinkAttributes() ?>>
<span><?php echo $block->escapeHtml($block->getLabel()) ?></span>
</a>
</div>
</span>
23 changes: 9 additions & 14 deletions app/code/Magento/Deploy/Model/DeployManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use Magento\Deploy\Model\Deploy\TemplateMinifier;
use Magento\Framework\App\State;

/**
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class DeployManager
{
/**
Expand Down Expand Up @@ -108,6 +111,9 @@ public function deploy()
{
if ($this->idDryRun) {
$this->output->writeln('Dry run. Nothing will be recorded to the target directory.');
} else {
$version = (new \DateTime())->getTimestamp();
$this->versionStorage->save($version);
}

/** @var DeployStrategyProvider $strategyProvider */
Expand All @@ -133,7 +139,9 @@ public function deploy()
}

$this->minifyTemplates();
$this->saveDeployedVersion();
if (!$this->idDryRun) {
$this->output->writeln("New version of deployed files: {$version}");
}

return $result;
}
Expand Down Expand Up @@ -197,17 +205,4 @@ private function getProcessesAmount()
{
return isset($this->options[Options::JOBS_AMOUNT]) ? (int)$this->options[Options::JOBS_AMOUNT] : 0;
}

/**
* Save version of deployed files
* @return void
*/
private function saveDeployedVersion()
{
if (!$this->idDryRun) {
$version = (new \DateTime())->getTimestamp();
$this->output->writeln("New version of deployed files: {$version}");
$this->versionStorage->save($version);
}
}
}
5 changes: 5 additions & 0 deletions app/code/Magento/Theme/etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,10 @@ Disallow: /*SID=
</allowed_resources>
</media_storage_configuration>
</system>
<dev>
<static>
<sign>1</sign>
</static>
</dev>
</default>
</config>
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public function testSaveFilePlaceholder($model)
public function testGetUrlPlaceholder($model)
{
$this->assertStringMatchesFormat(
'http://localhost/pub/static/frontend/%s/Magento_Catalog/images/product/placeholder/image.jpg',
'http://localhost/pub/static/%s/frontend/%s/Magento_Catalog/images/product/placeholder/image.jpg',
$model->getUrl()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function testGetConfig()
public function testGetConfigCssUrls()
{
$config = $this->_model->getConfig();
$publicPathPattern = 'http://localhost/pub/static/adminhtml/Magento/backend/en_US/mage/%s';
$publicPathPattern = 'http://localhost/pub/static/%s/adminhtml/Magento/backend/en_US/mage/%s';
$this->assertStringMatchesFormat($publicPathPattern, $config->getPopupCss());
$this->assertStringMatchesFormat($publicPathPattern, $config->getContentCss());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function testGetFilesCollection()
$this->assertInstanceOf(\Magento\Framework\DataObject::class, $item);
$this->assertStringEndsWith('/1.swf', $item->getUrl());
$this->assertStringMatchesFormat(
'http://%s/static/adminhtml/%s/%s/Magento_Cms/images/placeholder_thumbnail.jpg',
'http://%s/static/%s/adminhtml/%s/%s/Magento_Cms/images/placeholder_thumbnail.jpg',
$item->getThumbUrl()
);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public function cssDirectiveDataProvider()
* @magentoComponentsDir Magento/Email/Model/_files/design
* @magentoAppIsolation enabled
* @magentoDbIsolation enabled
* @magentoConfigFixture default_store dev/static/sign 0
* @dataProvider inlinecssDirectiveDataProvider
*
* @param string $templateText
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public function testGetProcessedTemplate()
->getArea(Area::AREA_FRONTEND)
->load();

$expectedViewUrl = 'static/frontend/Magento/blank/en_US/Magento_Theme/favicon.ico';
$expectedViewUrl = '/frontend/Magento/blank/en_US/Magento_Theme/favicon.ico';
$this->model->setDesignConfig([
'area' => 'frontend',
'store' => $this->objectManager->get(\Magento\Store\Model\StoreManagerInterface::class)
Expand Down Expand Up @@ -578,7 +578,6 @@ public function testGetProcessedTemplateSubject()
->getArea(Area::AREA_FRONTEND)
->load();

$expectedViewUrl = 'static/frontend/Magento/blank/en_US/Magento_Theme/favicon.ico';
$this->model->setTemplateSubject('{{view url="Magento_Theme::favicon.ico"}}');
$this->model->setDesignConfig([
'area' => 'frontend',
Expand All @@ -588,10 +587,16 @@ public function testGetProcessedTemplateSubject()
]);

$this->setNotDefaultThemeForFixtureStore();
$this->assertStringEndsNotWith($expectedViewUrl, $this->model->getProcessedTemplateSubject([]));
$this->assertStringMatchesFormat(
'%s/frontend/Magento/luma/en_US/Magento_Theme/favicon.ico',
$this->model->getProcessedTemplateSubject([])
);

$this->setDefaultThemeForFixtureStore();
$this->assertStringEndsWith($expectedViewUrl, $this->model->getProcessedTemplateSubject([]));
$this->assertStringMatchesFormat(
'%s/frontend/Magento/blank/en_US/Magento_Theme/favicon.ico',
$this->model->getProcessedTemplateSubject([])
);
}

/**
Expand All @@ -605,7 +610,7 @@ public function testGetDefaultEmailLogo()
->load();

$this->assertStringEndsWith(
'static/frontend/Magento/luma/en_US/Magento_Email/logo_email.png',
'/frontend/Magento/luma/en_US/Magento_Email/logo_email.png',
$this->model->getDefaultEmailLogo()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ public function testGetUrl()
public function testGetViewFileUrl()
{
$actualResult = $this->_block->getViewFileUrl('css/styles.css');
$this->assertStringMatchesFormat('http://localhost/pub/static/frontend/%s/en_US/css/styles.css', $actualResult);
$this->assertStringMatchesFormat(
'http://localhost/pub/static/%s/frontend/%s/en_US/css/styles.css',
$actualResult
);
}

public function testGetModuleName()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ public function testListActionDesign()
$this->getRequest()->setParam('id', $product->getId());
$this->dispatch('review/product/listAction');
$result = $this->getResponse()->getBody();
$this->assertContains("static/frontend/Magento/blank/en_US/Magento_Theme/favicon.ico", $result);
$this->assertContains("/frontend/Magento/blank/en_US/Magento_Theme/favicon.ico", $result);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@ class ConfigTest extends \PHPUnit_Framework_TestCase

protected function setUp()
{
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
$this->_model = \Magento\TestFramework\Helper\Bootstrap::getObjectManager()->create(
\Magento\Variable\Model\Variable\Config::class
);
}

public function testGetWysiwygJsPluginSrc()
{
$src = $this->_model->getWysiwygJsPluginSrc();
$this->assertStringStartsWith('http://localhost/pub/static/adminhtml/Magento/backend/en_US/mage/adminhtml/',
$src);
$this->assertStringEndsWith('editor_plugin.js', $src);
$this->assertStringMatchesFormat(
'http://localhost/pub/static/%s/adminhtml/Magento/backend/en_US/mage/adminhtml/%s/editor_plugin.js',
$src
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ public function testGetPluginSettings()
$this->assertArrayHasKey('widget_window_url', $settings);

$jsFilename = $settings['widget_plugin_src'];
$this->assertStringStartsWith('http://localhost/pub/static/adminhtml/Magento/backend/en_US/', $jsFilename);
$this->assertStringEndsWith('editor_plugin.js', $jsFilename);
$this->assertStringMatchesFormat(
'http://localhost/pub/static/%s/adminhtml/Magento/backend/en_US/%s/editor_plugin.js',
$jsFilename
);

$this->assertInternalType('array', $settings['widget_placeholders']);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@

<xs:simpleType name="elementNameType">
<xs:restriction base="xs:string">
<xs:pattern value="[a-zA-Z][a-zA-Z\d\-_\.]*"/>
<xs:pattern value="[a-zA-Z0-9][a-zA-Z\d\-_\.]*"/>
</xs:restriction>
</xs:simpleType>

Expand Down

0 comments on commit 2842e92

Please sign in to comment.