\S+)_replica$#i';
+ }
+
+ return $this->filterPattern;
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/constraints/constraint.xsd b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/constraints/constraint.xsd
index 61540ecc616b0..8c264bd95a076 100644
--- a/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/constraints/constraint.xsd
+++ b/lib/internal/Magento/Framework/Setup/Declaration/Schema/etc/constraints/constraint.xsd
@@ -10,6 +10,6 @@
-
+
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php
index 0a2eb60fda48a..15dfcc746407e 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Db/SchemaBuilderTest.php
@@ -133,7 +133,8 @@ public function dataProvider()
'type' => 'primary',
'column' => [
'first_column'
- ]
+ ],
+ 'nameWithoutPrefix' => 'PRIMARY',
]
]
],
@@ -141,9 +142,10 @@ public function dataProvider()
'second_table' => [
'FIRST_INDEX' => [
'name' => 'FIRST_INDEX',
+ 'nameWithoutPrefix' => 'FIRST_INDEX',
'column' => [
'ref_column'
- ]
+ ],
]
]
]
@@ -221,6 +223,7 @@ private function createPrimaryConstraint(Table $table, array $columns)
'PRIMARY',
'primary',
$table,
+ 'PRIMARY',
$columns
);
}
@@ -240,7 +243,8 @@ private function createIndex($indexName, Table $table, array $columns)
'index',
$table,
$columns,
- 'btree'
+ 'btree',
+ $indexName
);
}
@@ -370,6 +374,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co
'some_foreign_key',
'foreign',
$table,
+ 'some_foreign_key',
$foreignColumn,
$refTable,
$refColumn,
@@ -429,6 +434,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co
'type' => 'primary',
'columns' => [$firstColumn],
'table' => $table,
+ 'nameWithoutPrefix' => 'PRIMARY',
'column' => ['first_column'],
]
],
@@ -460,6 +466,7 @@ private function prepareSchemaMocks(array $columns, array $references, array $co
'table' => $refTable,
'column' => ['ref_column'],
'columns' => [$refColumn],
+ 'nameWithoutPrefix' => 'FIRST_INDEX',
]
],
[
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php
index f596a448f1aba..a590a50edb72f 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Declaration/SchemaBuilderTest.php
@@ -241,14 +241,16 @@ private function createIntegerColumn($name, Table $table)
*
* @param Table $table
* @param array $columns
+ * @param string $nameWithoutPrefix
* @return Internal
*/
- private function createPrimaryConstraint(Table $table, array $columns)
+ private function createPrimaryConstraint(Table $table, array $columns, $nameWithoutPrefix = 'PRIMARY')
{
return new Internal(
'PRIMARY',
'primary',
$table,
+ $nameWithoutPrefix,
$columns
);
}
@@ -259,16 +261,18 @@ private function createPrimaryConstraint(Table $table, array $columns)
* @param string $indexName
* @param Table $table
* @param array $columns
+ * @param string|null $nameWithoutPrefix
* @return Index
*/
- private function createIndex($indexName, Table $table, array $columns)
+ private function createIndex($indexName, Table $table, array $columns, $nameWithoutPrefix = null)
{
return new Index(
$indexName,
'index',
$table,
$columns,
- 'btree'
+ 'btree',
+ $nameWithoutPrefix ?: $indexName
);
}
@@ -295,13 +299,14 @@ private function createTimestampColumn($name, Table $table)
* @dataProvider tablesProvider
* @param array $tablesData
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @throws \Magento\Framework\Setup\Exception
*/
public function testBuild(array $tablesData)
{
$table = $this->createTable('first_table');
$refTable = $this->createTable('second_table');
$refColumn = $this->createIntegerColumn('ref_column', $refTable);
- $index = $this->createIndex('FIRST_INDEX', $table, [$refColumn]);
+ $index = $this->createIndex('PRE_FIRST_INDEX', $table, [$refColumn], 'FIRST_INDEX');
$refTable->addColumns([$refColumn]);
$refTable->addIndexes([$index]);
$firstColumn = $this->createIntegerAIColumn('first_column', $table);
@@ -312,6 +317,7 @@ public function testBuild(array $tablesData)
'some_foreign_key',
'foreign',
$table,
+ 'some_foreign_key',
$foreignColumn,
$refTable,
$refColumn,
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php
index 8a8aecb818348..22dc6c6d18a9e 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Diff/DiffManagerTest.php
@@ -107,8 +107,8 @@ public function testRegisterIndexModification()
''
);
$column = new Column('third', 'int', $table, 'Previous column');
- $index = new Index('index_type', 'index', $table, [$column], 'btree');
- $generatedIndex = new Index('index_type', 'index', $table, [$column], 'hash');
+ $index = new Index('index_type', 'index', $table, [$column], 'btree', 'index_type');
+ $generatedIndex = new Index('index_type', 'index', $table, [$column], 'hash', 'index_type');
$diff->expects(self::exactly(2))
->method('register')
->withConsecutive([$generatedIndex, 'drop_element', $generatedIndex], [$index, 'add_complex_element']);
@@ -142,7 +142,7 @@ public function testRegisterRemovalReference()
''
);
$column = new Column('third', 'int', $table, 'Previous column');
- $reference = new Reference('ref', 'foreign', $table, $column, $refTable, $column, 'CASCADE');
+ $reference = new Reference('ref', 'foreign', $table, 'ref', $column, $refTable, $column, 'CASCADE');
$diff->expects(self::exactly(2))
->method('register')
->withConsecutive(
@@ -169,7 +169,7 @@ public function testRegisterCreation()
''
);
$column = new Column('third', 'int', $table, 'Previous column');
- $reference = new Reference('ref', 'foreign', $table, $column, $table, $column, 'CASCADE');
+ $reference = new Reference('ref', 'foreign', $table, 'ref', $column, $table, $column, 'CASCADE');
$diff->expects(self::exactly(3))
->method('register')
->withConsecutive(
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/ForeignTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/ForeignTest.php
new file mode 100644
index 0000000000000..ee4331e7bfc5b
--- /dev/null
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Dto/Factories/ForeignTest.php
@@ -0,0 +1,187 @@
+objectManagerHelper = new ObjectManagerHelper($this);
+ $this->objectManagerMock = $this->getMockBuilder(ObjectManagerInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->resourceConnectionMock = $this->getMockBuilder(ResourceConnection::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->adapterMock = $this->getMockBuilder(AdapterInterface::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+ $this->tableNameResolver = $this->getMockBuilder(TableNameResolver::class)
+ ->disableOriginalConstructor()
+ ->getMock();
+
+ $this->foreignFactory = $this->objectManagerHelper->getObject(
+ Foreign::class,
+ [
+ 'objectManager' => $this->objectManagerMock,
+ 'resourceConnection' => $this->resourceConnectionMock,
+ 'tableNameResolver' => $this->tableNameResolver,
+ ]
+ );
+ }
+
+ /**
+ * @param string $prefix
+ * @dataProvider createDataProvider
+ */
+ public function testCreate(string $prefix)
+ {
+ $resource = 'default';
+ $tableNameWithoutPrefix = 'table_name';
+ $tableName = $prefix . $tableNameWithoutPrefix;
+
+ $columnName = 'entity_id';
+ $referenceTableName = 'second_table';
+ $referenceColumnName = 'website_id';
+
+ $foreignKeyNameWithoutPrefix = 'table_name_field_name';
+ $foreignKeyName = $prefix . $foreignKeyNameWithoutPrefix;
+
+ $table = $this->objectManagerHelper->getObject(
+ DataObject::class,
+ [
+ 'data' => [
+ 'resource' => $resource,
+ 'name' => $tableName,
+ 'name_without_prefix' => $tableNameWithoutPrefix,
+ ],
+ ]
+ );
+
+ $columnMock = $this->objectManagerHelper->getObject(
+ DataObject::class,
+ [
+ 'data' => ['name' => $columnName],
+ ]
+ );
+
+ $referenceTableMock = $this->objectManagerHelper->getObject(
+ DataObject::class,
+ [
+ 'data' => ['name_without_prefix' => $referenceTableName],
+ ]
+ );
+
+ $referenceColumnMock = $this->objectManagerHelper->getObject(
+ DataObject::class,
+ [
+ 'data' => ['name' => $referenceColumnName],
+ ]
+ );
+
+ $data = [
+ 'name' => $foreignKeyName,
+ 'table' => $table,
+ 'column' => $columnMock,
+ 'referenceTable' => $referenceTableMock,
+ 'referenceColumn' => $referenceColumnMock,
+ ];
+
+ $expectedData = array_merge(
+ $data,
+ [
+ 'onDelete' => Foreign::DEFAULT_ON_DELETE,
+ 'nameWithoutPrefix' => $foreignKeyNameWithoutPrefix,
+ ]
+ );
+
+ $this->resourceConnectionMock
+ ->method('getTablePrefix')
+ ->willReturn($prefix);
+
+ $this->resourceConnectionMock
+ ->method('getConnection')
+ ->with($resource)
+ ->willReturn($this->adapterMock);
+
+ $this->tableNameResolver
+ ->method('getNameOfOriginTable')
+ ->with($tableNameWithoutPrefix)
+ ->willReturn($tableNameWithoutPrefix);
+
+ $this->adapterMock
+ ->method('getForeignKeyName')
+ ->with($tableNameWithoutPrefix, $columnName, $referenceTableName, $referenceColumnName)
+ ->willReturn($foreignKeyNameWithoutPrefix);
+
+ $this->objectManagerMock
+ ->expects($this->once())
+ ->method('create')
+ ->with(Reference::class, $expectedData);
+
+ $this->foreignFactory->create($data);
+ }
+
+ /**
+ * @return array
+ */
+ public function createDataProvider(): array
+ {
+ return [
+ 'Prefix is defined' => [
+ 'pref_',
+ ],
+ 'Prefix is not defined' => [
+ '',
+ ],
+ ];
+ }
+}
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php
index d061fc1fb6c9c..a8a8fb5b0c40c 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/Operations/AddColumnTest.php
@@ -179,7 +179,7 @@ public function testDoOperation()
->method('addElement')
->with('int', 'default', 'table', $definition, 'column')
->willReturn($statement);
- $index = new Index('index', 'index', $column->getTable(), [$column], 'btree');
+ $index = new Index('index', 'index', $column->getTable(), [$column], 'btree', 'index');
$this->elementFactoryMock->expects(self::once())
->method('create')
->willReturn($index);
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php
index a0bf758004346..396cc2b2e5b34 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/CheckReferenceColumnHasIndexTest.php
@@ -60,6 +60,7 @@ public function testValidate()
'ref',
'foreign',
$table,
+ 'ref',
$column,
$refTable,
$refColumn,
diff --git a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php
index c4e88b569d9c2..ad547053f7bf2 100644
--- a/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php
+++ b/lib/internal/Magento/Framework/Setup/Test/Unit/Declaration/Schema/ValidationRules/ValidationRulesTest.php
@@ -64,6 +64,7 @@ public function testValidate()
'ref',
'foreign',
$table,
+ 'ref',
$column,
$refTable,
$refColumn,
diff --git a/lib/internal/Magento/Framework/Webapi/Rest/Response/FieldsFilter.php b/lib/internal/Magento/Framework/Webapi/Rest/Response/FieldsFilter.php
index 9b50b45a9215c..87be46c111545 100644
--- a/lib/internal/Magento/Framework/Webapi/Rest/Response/FieldsFilter.php
+++ b/lib/internal/Magento/Framework/Webapi/Rest/Response/FieldsFilter.php
@@ -106,9 +106,9 @@ protected function parse($filterString)
}
switch ($filterString[$position]) {
case '[':
- array_push($parent, $currentElement);
+ $parent[] = $currentElement;
// push current field in stack and initialize current
- array_push($stack, $current);
+ $stack[] = $current;
$current = [];
break;
diff --git a/lib/web/css/source/lib/_navigation.less b/lib/web/css/source/lib/_navigation.less
index 56aa2e7ef86b9..b2ed4352a334a 100644
--- a/lib/web/css/source/lib/_navigation.less
+++ b/lib/web/css/source/lib/_navigation.less
@@ -355,6 +355,25 @@
overflow: visible !important;
}
+ &.parent {
+ > .level-top {
+ padding-right: 20px;
+
+ > .ui-menu-icon {
+ position: absolute;
+ right: 0;
+
+ .lib-icon-font(
+ @icon-down,
+ @_icon-font-size: 12px,
+ @_icon-font-line-height: 20px,
+ @_icon-font-text-hide: true,
+ @_icon-font-position: after
+ );
+ }
+ }
+ }
+
.submenu {
.lib-css(background, @_submenu-background-color);
.lib-css(border, @_submenu-border-width @_submenu-border-style @_submenu-border-color);
@@ -414,6 +433,26 @@
left: auto !important;
right: 100%;
}
+
+ li {
+ margin: 0;
+ &.parent {
+ > a {
+ > .ui-menu-icon {
+ position: absolute;
+ right: 3px;
+
+ .lib-icon-font(
+ @icon-next,
+ @_icon-font-size: 12px,
+ @_icon-font-line-height: 20px,
+ @_icon-font-text-hide: true,
+ @_icon-font-position: after
+ );
+ }
+ }
+ }
+ }
}
&.more {
diff --git a/lib/web/mage/calendar.js b/lib/web/mage/calendar.js
index 51ee9b3a8891a..ac154b333801d 100644
--- a/lib/web/mage/calendar.js
+++ b/lib/web/mage/calendar.js
@@ -236,12 +236,14 @@
firstDay = parseInt(this._get(inst, 'firstDay'), 10);
firstDay = isNaN(firstDay) ? 0 : firstDay;
- for (row; row < numMonths[0]; row++) {
+ for (row = 0; row < numMonths[0]; row++) {
this.maxRows = 4;
- for (col; col < numMonths[1]; col++) {
+ for (col = 0; col < numMonths[1]; col++) {
selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
+ calender = '';
+
if (isMultiMonth) {
calender += '' + this._get(inst, 'weekHeader') + '' : '';
- for (dow; dow < 7; dow++) { // days of the week
+ for (dow = 0; dow < 7; dow++) { // days of the week
day = (dow + firstDay) % 7;
thead += '
= 5 ?
' class="ui-datepicker-week-end"' : '') + '>' +
@@ -289,7 +291,7 @@
this.maxRows = numRows;
printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
- for (dRow; dRow < numRows; dRow++) { // create date picker rows
+ for (dRow = 0; dRow < numRows; dRow++) { // create date picker rows
calender += ' | ';
tbody = !showWeek ? '' : '| ' +
this._get(inst, 'calculateWeek')(printDate) + ' | ';
diff --git a/lib/web/mage/trim-input.js b/lib/web/mage/trim-input.js
new file mode 100644
index 0000000000000..678192dcf61ac
--- /dev/null
+++ b/lib/web/mage/trim-input.js
@@ -0,0 +1,60 @@
+/**
+ * Copyright © Magento, Inc. All rights reserved.
+ * See COPYING.txt for license details.
+ */
+
+define([
+ 'jquery'
+], function ($) {
+ 'use strict';
+
+ $.widget('mage.trimInput', {
+ options: {
+ cache: {}
+ },
+
+ /**
+ * Widget initialization
+ * @private
+ */
+ _create: function () {
+ this.options.cache.input = $(this.element);
+ this._bind();
+ },
+
+ /**
+ * Event binding, will monitor change, keyup and paste events.
+ * @private
+ */
+ _bind: function () {
+ if (this.options.cache.input.length) {
+ this._on(this.options.cache.input, {
+ 'change': this._trimInput,
+ 'keyup': this._trimInput,
+ 'paste': this._trimInput
+ });
+ }
+ },
+
+ /**
+ * Trim value
+ * @private
+ */
+ _trimInput: function () {
+ var input = this._getInputValue().trim();
+
+ this.options.cache.input.val(input);
+ },
+
+ /**
+ * Get input value
+ * @returns {*}
+ * @private
+ */
+ _getInputValue: function () {
+ return this.options.cache.input.val();
+ }
+ });
+
+ return $.mage.trimInput;
+});
diff --git a/lib/web/modernizr/modernizr.js b/lib/web/modernizr/modernizr.js
index 9b4f68aaaaaa9..0833cfb105cee 100644
--- a/lib/web/modernizr/modernizr.js
+++ b/lib/web/modernizr/modernizr.js
@@ -910,7 +910,7 @@ window.Modernizr = (function( window, document, undefined ) {
bool = inputElem.checkValidity && inputElem.checkValidity() === false;
} else {
- // If the upgraded input compontent rejects the :) text, we got a winner
+ // If the upgraded input component rejects the :) text, we got a winner
bool = inputElem.value != smile;
}
}
diff --git a/setup/src/Magento/Setup/Fixtures/OrdersFixture.php b/setup/src/Magento/Setup/Fixtures/OrdersFixture.php
index 1acad6dbc1787..9fbec3b3741b2 100644
--- a/setup/src/Magento/Setup/Fixtures/OrdersFixture.php
+++ b/setup/src/Magento/Setup/Fixtures/OrdersFixture.php
@@ -14,7 +14,7 @@
* Optionally generates inactive quotes for generated orders.
*
* Support the following format:
- *
+ *
* {bool}
*
*
diff --git a/setup/src/Magento/Setup/Module/Dependency/Circular.php b/setup/src/Magento/Setup/Module/Dependency/Circular.php
index 8f5bd8716f650..a10d2752fa410 100644
--- a/setup/src/Magento/Setup/Module/Dependency/Circular.php
+++ b/setup/src/Magento/Setup/Module/Dependency/Circular.php
@@ -118,7 +118,7 @@ protected function buildCircular($modules)
return;
}
$this->circularDependencies[$path] = $modules;
- array_push($modules, array_shift($modules));
+ $modules[] = array_shift($modules);
$this->buildCircular($modules);
}
@@ -133,7 +133,7 @@ protected function divideByModules($circularDependencies)
$dependenciesByModule = [];
foreach ($circularDependencies as $circularDependency) {
$module = $circularDependency[0];
- array_push($circularDependency, $module);
+ $circularDependency[] = $module;
$dependenciesByModule[$module][] = $circularDependency;
}
diff --git a/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlInterceptorScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlInterceptorScanner.php
index e88ca9197096a..75c6e1144e8d2 100644
--- a/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlInterceptorScanner.php
+++ b/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlInterceptorScanner.php
@@ -42,9 +42,9 @@ protected function _collectEntitiesFromString($content)
$attributes = $entityNode->attributes;
$type = $attributes->getNamedItem('type');
if ($type !== null) {
- array_push($output, $type->nodeValue);
+ $output[] = $type->nodeValue;
} else {
- array_push($output, $attributes->getNamedItem('name')->nodeValue);
+ $output[] = $attributes->getNamedItem('name')->nodeValue;
}
}
return $output;
@@ -80,7 +80,7 @@ protected function _filterEntities(array $output)
$this->_handleControllerClassName($entityName);
}
if (class_exists($entityName) || interface_exists($entityName)) {
- array_push($filteredEntities, $entityName . '\\Interceptor');
+ $filteredEntities[] = $entityName . '\\Interceptor';
}
}
return $filteredEntities;
diff --git a/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlScanner.php b/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlScanner.php
index 37388f563e75b..a606c266d3827 100644
--- a/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlScanner.php
+++ b/setup/src/Magento/Setup/Module/Di/Code/Scanner/XmlScanner.php
@@ -104,7 +104,7 @@ protected function _filterEntities(array $output)
}
if (false === $isClassExists) {
if (class_exists($entityName) || interface_exists($entityName)) {
- array_push($filteredEntities, $className);
+ $filteredEntities[] = $className;
} else {
$this->_log->add(
\Magento\Setup\Module\Di\Compiler\Log\Log::CONFIGURATION_ERROR,