Skip to content

Commit 816ec39

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.2-develop
Accepted Public Pull Requests: - #12752: #4292: Ability to sitch to default mode (by @Etty) - #12963: Sort configurable attribute options by sort_order (by @wardcapp) - #12953: [Backport to 2.2-develop] Fix #2156 Js\Dataprovider uses the RendererInterface. (by @dverkade) - #12521: Match flexible static file version in nginx sample config (by @scottsb) Fixed GitHub Issues: - #4292: Why can't one switch back to default mode ? (reported by @digitalpianism) has been fixed in #12752 by @Etty in 2.2-develop branch Related commits: 1. ba219b8 - #7441: Configurable attribute options are not sorted (reported by @DariuszMaciejewski) has been fixed in #12963 by @wardcapp in 2.2-develop branch Related commits: 1. 9794d38 - #2156: Why does \Magento\Translation\Model\Js\DataProvider use \Magento\Framework\Phrase\Renderer\Translate, not \Magento\Framework\Phrase\Renderer\Composite? (reported by @dmitry-fedyuk) has been fixed in #12953 by @dverkade in 2.2-develop branch Related commits: 1. cfce631
2 parents 79d8e9a + ec6281c commit 816ec39

File tree

8 files changed

+83
-8
lines changed

8 files changed

+83
-8
lines changed

app/code/Magento/ConfigurableProduct/Model/ResourceModel/Attribute/OptionSelectBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ public function getSelect(AbstractAttribute $superAttribute, int $productId, Sco
9191
]
9292
),
9393
[]
94+
)->joinInner(
95+
['attribute_option' => $this->attributeResource->getTable('eav_attribute_option')],
96+
'attribute_option.option_id = entity_value.value',
97+
[]
98+
)->order(
99+
'attribute_option.sort_order ASC'
94100
)->where(
95101
'super_attribute.product_id = ?',
96102
$productId

app/code/Magento/ConfigurableProduct/Test/Unit/Model/ResourceModel/Attribute/OptionSelectBuilderTest.php

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ protected function setUp()
6666
->disableOriginalConstructor()
6767
->getMockForAbstractClass();
6868
$this->select = $this->getMockBuilder(Select::class)
69-
->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns'])
69+
->setMethods(['from', 'joinInner', 'joinLeft', 'where', 'columns', 'order'])
7070
->disableOriginalConstructor()
7171
->getMock();
7272
$this->connectionMock->expects($this->atLeastOnce())
@@ -112,10 +112,28 @@ public function testGetSelect()
112112
{
113113
$this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
114114
$this->select->expects($this->exactly(1))->method('columns')->willReturnSelf();
115-
$this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
115+
$this->select->expects($this->exactly(6))->method('joinInner')->willReturnSelf();
116116
$this->select->expects($this->exactly(3))->method('joinLeft')->willReturnSelf();
117+
$this->select->expects($this->exactly(1))->method('order')->willReturnSelf();
117118
$this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
118119

120+
$this->attributeResourceMock->expects($this->exactly(9))
121+
->method('getTable')
122+
->will(
123+
$this->returnValueMap(
124+
[
125+
['catalog_product_super_attribute', 'catalog_product_super_attribute value'],
126+
['catalog_product_entity', 'catalog_product_entity value'],
127+
['catalog_product_super_link', 'catalog_product_super_link value'],
128+
['eav_attribute', 'eav_attribute value'],
129+
['catalog_product_entity', 'catalog_product_entity value'],
130+
['catalog_product_super_attribute_label', 'catalog_product_super_attribute_label value'],
131+
['eav_attribute_option', 'eav_attribute_option value'],
132+
['eav_attribute_option_value', 'eav_attribute_option_value value']
133+
]
134+
)
135+
);
136+
119137
$this->abstractAttributeMock->expects($this->atLeastOnce())
120138
->method('getAttributeId')
121139
->willReturn('getAttributeId value');
@@ -138,10 +156,27 @@ public function testGetSelectWithBackendModel()
138156
{
139157
$this->select->expects($this->exactly(1))->method('from')->willReturnSelf();
140158
$this->select->expects($this->exactly(0))->method('columns')->willReturnSelf();
141-
$this->select->expects($this->exactly(5))->method('joinInner')->willReturnSelf();
159+
$this->select->expects($this->exactly(6))->method('joinInner')->willReturnSelf();
142160
$this->select->expects($this->exactly(1))->method('joinLeft')->willReturnSelf();
161+
$this->select->expects($this->exactly(1))->method('order')->willReturnSelf();
143162
$this->select->expects($this->exactly(2))->method('where')->willReturnSelf();
144163

164+
$this->attributeResourceMock->expects($this->exactly(7))
165+
->method('getTable')
166+
->will(
167+
$this->returnValueMap(
168+
[
169+
['catalog_product_super_attribute', 'catalog_product_super_attribute value'],
170+
['catalog_product_entity', 'catalog_product_entity value'],
171+
['catalog_product_super_link', 'catalog_product_super_link value'],
172+
['eav_attribute', 'eav_attribute value'],
173+
['catalog_product_entity', 'catalog_product_entity value'],
174+
['catalog_product_super_attribute_label', 'catalog_product_super_attribute_label value'],
175+
['eav_attribute_option', 'eav_attribute_option value']
176+
]
177+
)
178+
);
179+
145180
$this->abstractAttributeMock->expects($this->atLeastOnce())
146181
->method('getAttributeId')
147182
->willReturn('getAttributeId value');

app/code/Magento/Deploy/Console/Command/SetModeCommand.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
101101
$modeController->enableProductionMode();
102102
}
103103
break;
104+
case State::MODE_DEFAULT:
105+
$modeController->enableDefaultMode();
106+
break;
104107
default:
105108
throw new LocalizedException(__('Cannot switch into given mode "%1"', $toMode));
106109
}

app/code/Magento/Deploy/Model/Mode.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,25 @@ public function enableDeveloperMode()
177177
$this->setStoreMode(State::MODE_DEVELOPER);
178178
}
179179

180+
/**
181+
* Enable Default mode
182+
*
183+
* @return void
184+
*/
185+
public function enableDefaultMode()
186+
{
187+
$this->filesystem->cleanupFilesystem(
188+
[
189+
DirectoryList::CACHE,
190+
DirectoryList::GENERATED_CODE,
191+
DirectoryList::GENERATED_METADATA,
192+
DirectoryList::TMP_MATERIALIZATION_DIR,
193+
DirectoryList::STATIC_VIEW,
194+
]
195+
);
196+
$this->setStoreMode(State::MODE_DEFAULT);
197+
}
198+
180199
/**
181200
* Get current mode information
182201
*

app/code/Magento/Deploy/Test/Unit/Console/Command/SetModeCommandTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,18 @@ public function testSetDeveloperMode()
6767
);
6868
}
6969

70+
public function testSetDefaultMode()
71+
{
72+
$this->modeMock->expects($this->once())->method('enableDefaultMode');
73+
74+
$tester = new CommandTester($this->command);
75+
$tester->execute(['mode' => 'default']);
76+
$this->assertContains(
77+
"default mode",
78+
$tester->getDisplay()
79+
);
80+
}
81+
7082
public function testSetProductionSkipCompilation()
7183
{
7284
$this->modeMock->expects($this->once())->method('enableProductionModeMinimal');

app/code/Magento/Translation/Model/Js/DataProvider.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,15 @@ class DataProvider implements DataProviderInterface
4646
/**
4747
* Basic translate renderer
4848
*
49-
* @var \Magento\Framework\Phrase\Renderer\Translate
49+
* @var \Magento\Framework\Phrase\RendererInterface
5050
*/
5151
protected $translate;
5252

5353
/**
5454
* @param \Magento\Framework\App\State $appState
5555
* @param Config $config
5656
* @param \Magento\Framework\Filesystem\File\ReadFactory $fileReadFactory
57-
* @param \Magento\Framework\Phrase\Renderer\Translate $translate
57+
* @param \Magento\Framework\Phrase\RendererInterface $translate
5858
* @param \Magento\Framework\Component\ComponentRegistrar $componentRegistrar
5959
* @param \Magento\Framework\Component\DirSearch $dirSearch
6060
* @param \Magento\Framework\View\Design\Theme\ThemePackageList $themePackageList
@@ -64,7 +64,7 @@ public function __construct(
6464
\Magento\Framework\App\State $appState,
6565
Config $config,
6666
\Magento\Framework\Filesystem\File\ReadFactory $fileReadFactory,
67-
\Magento\Framework\Phrase\Renderer\Translate $translate,
67+
\Magento\Framework\Phrase\RendererInterface $translate,
6868
\Magento\Framework\Component\ComponentRegistrar $componentRegistrar,
6969
\Magento\Framework\Component\DirSearch $dirSearch,
7070
\Magento\Framework\View\Design\Theme\ThemePackageList $themePackageList,

lib/internal/Magento/Framework/Phrase/Test/Unit/Renderer/InlineTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class InlineTest extends \PHPUnit\Framework\TestCase
1313
protected $translator;
1414

1515
/**
16-
* @var \Magento\Framework\Phrase\Renderer\Translate
16+
* @var \Magento\Framework\Phrase\Renderer\Inline
1717
*/
1818
protected $renderer;
1919

nginx.conf.sample

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ location /static/ {
100100

101101
# Remove signature of the static files that is used to overcome the browser cache
102102
location ~ ^/static/version {
103-
rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
103+
rewrite ^/static/(version[^/]+/)?(.*)$ /static/$2 last;
104104
}
105105

106106
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2)$ {

0 commit comments

Comments
 (0)