Skip to content

Commit 5bf4909

Browse files
committed
Merge branch 'ACP2E-1700' of https://github.com/magento-l3/magento2ce into PR-L3-03132023
2 parents fc4cece + c3b4b3e commit 5bf4909

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

app/code/Magento/Config/Model/Config.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,10 @@ public function save()
182182
return $this;
183183
}
184184

185+
/**
186+
* Reload config to make sure config data is consistent with the database at this point.
187+
*/
188+
$this->_appConfig->reinit();
185189
$oldConfig = $this->_getConfig(true);
186190

187191
/** @var \Magento\Framework\DB\Transaction $deleteTransaction */

app/code/Magento/Config/Test/Unit/Model/ConfigTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ protected function setUp(): void
175175
*/
176176
public function testSaveDoesNotDoAnythingIfGroupsAreNotPassed(): void
177177
{
178+
$this->appConfigMock->expects($this->never())
179+
->method('reinit');
178180
$this->configLoaderMock->expects($this->never())->method('getConfigByPath');
179181
$this->model->save();
180182
}
@@ -184,6 +186,8 @@ public function testSaveDoesNotDoAnythingIfGroupsAreNotPassed(): void
184186
*/
185187
public function testSaveEmptiesNonSetArguments(): void
186188
{
189+
$this->appConfigMock->expects($this->never())
190+
->method('reinit');
187191
$this->structureReaderMock->expects($this->never())->method('getConfiguration');
188192
$this->assertNull($this->model->getSection());
189193
$this->assertNull($this->model->getWebsite());
@@ -199,6 +203,8 @@ public function testSaveEmptiesNonSetArguments(): void
199203
*/
200204
public function testSaveToCheckAdminSystemConfigChangedSectionEvent(): void
201205
{
206+
$this->appConfigMock->expects($this->exactly(2))
207+
->method('reinit');
202208
$transactionMock = $this->createMock(Transaction::class);
203209

204210
$this->transFactoryMock->expects($this->any())->method('create')->willReturn($transactionMock);
@@ -227,6 +233,8 @@ public function testSaveToCheckAdminSystemConfigChangedSectionEvent(): void
227233
*/
228234
public function testDoNotSaveReadOnlyFields(): void
229235
{
236+
$this->appConfigMock->expects($this->exactly(2))
237+
->method('reinit');
230238
$transactionMock = $this->createMock(Transaction::class);
231239
$this->transFactoryMock->expects($this->any())->method('create')->willReturn($transactionMock);
232240

@@ -265,6 +273,8 @@ public function testDoNotSaveReadOnlyFields(): void
265273
*/
266274
public function testSaveToCheckScopeDataSet(): void
267275
{
276+
$this->appConfigMock->expects($this->exactly(2))
277+
->method('reinit');
268278
$transactionMock = $this->createMock(Transaction::class);
269279
$this->transFactoryMock->expects($this->any())->method('create')->willReturn($transactionMock);
270280

0 commit comments

Comments
 (0)