Skip to content

Commit efae98d

Browse files
committed
Merge remote-tracking branch 'origin/MC-33278' into 2.4-develop-pr22
2 parents b759d66 + cc90338 commit efae98d

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

dev/tests/integration/testsuite/Magento/Developer/Model/Logger/Handler/DebugTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testDebugInDeveloperMode()
139139
{
140140
$message = 'test message';
141141
$this->reinitDebugHandler(State::MODE_DEVELOPER);
142-
142+
$this->deploymentConfig->resetData();
143143
$this->removeDebugLog();
144144
$this->logger->debug($message);
145145
$this->assertFileExists($this->getDebuggerLogPath());

lib/internal/Magento/Framework/App/DeploymentConfig.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
* Application deployment configuration
1616
*
1717
* @api
18+
* @since 100.0.2
1819
*/
1920
class DeploymentConfig
2021
{
@@ -148,7 +149,7 @@ public function isDbAvailable()
148149
*/
149150
private function load()
150151
{
151-
if (null === $this->data) {
152+
if (empty($this->data)) {
152153
$this->data = $this->reader->load();
153154
if ($this->overrideData) {
154155
$this->data = array_replace($this->data, $this->overrideData);
@@ -183,6 +184,7 @@ private function flattenParams(array $params, $path = null, array &$flattenResul
183184
$newPath = $key;
184185
}
185186
if (isset($flattenResult[$newPath])) {
187+
//phpcs:ignore Magento2.Exceptions.DirectThrow
186188
throw new RuntimeException(new Phrase("Key collision '%1' is already defined.", [$newPath]));
187189
}
188190
$flattenResult[$newPath] = $param;

lib/internal/Magento/Framework/App/Test/Unit/DeploymentConfigTest.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66

77
namespace Magento\Framework\App\Test\Unit;
88

9-
use \Magento\Framework\App\DeploymentConfig;
10-
use \Magento\Framework\Config\ConfigOptionsListConstants;
9+
use Magento\Framework\App\DeploymentConfig;
10+
use Magento\Framework\Config\ConfigOptionsListConstants;
11+
use PHPUnit\Framework\MockObject\MockObject;
12+
use PHPUnit\Framework\TestCase;
1113

12-
class DeploymentConfigTest extends \PHPUnit\Framework\TestCase
14+
class DeploymentConfigTest extends TestCase
1315
{
1416
/**
1517
* @var array
@@ -63,7 +65,7 @@ class DeploymentConfigTest extends \PHPUnit\Framework\TestCase
6365
protected $_deploymentConfigMerged;
6466

6567
/**
66-
* @var \PHPUnit_Framework_MockObject_MockObject
68+
* @var MockObject
6769
*/
6870
private $reader;
6971

@@ -124,7 +126,7 @@ public function testNotAvailable(): void
124126
*/
125127
public function testNotAvailableThenAvailable(): void
126128
{
127-
$this->reader->expects($this->once())->method('load')->willReturn([]);
129+
$this->reader->expects($this->once())->method('load')->willReturn(['Test']);
128130
$object = new DeploymentConfig($this->reader);
129131
$this->assertFalse($object->isAvailable());
130132
$this->assertFalse($object->isAvailable());

lib/internal/Magento/Framework/Locale/Resolver.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
class Resolver implements ResolverInterface
1616
{
1717
/**
18-
* Default locale
18+
* Resolver default locale
1919
*/
2020
const DEFAULT_LOCALE = 'en_US';
2121

@@ -79,7 +79,7 @@ public function __construct(
7979
$this->scopeConfig = $scopeConfig;
8080
$this->defaultLocalePath = $defaultLocalePath;
8181
$this->scopeType = $scopeType;
82-
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->create(DeploymentConfig::class);
82+
$this->deploymentConfig = $deploymentConfig ?: ObjectManager::getInstance()->get(DeploymentConfig::class);
8383
$this->setLocale($locale);
8484
}
8585

lib/internal/Magento/Framework/Module/ModuleList.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,8 @@ public function isModuleInfoAvailable()
140140
*/
141141
private function loadConfigData()
142142
{
143-
if (null === $this->configData) {
144-
$this->config->resetData();
145-
if (null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
146-
$this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
147-
}
143+
if (null === $this->configData && null !== $this->config->get(ConfigOptionsListConstants::KEY_MODULES)) {
144+
$this->configData = $this->config->get(ConfigOptionsListConstants::KEY_MODULES);
148145
}
149146
}
150147
}

lib/internal/Magento/Framework/Module/Test/Unit/ModuleListTest.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@
55
*/
66
namespace Magento\Framework\Module\Test\Unit;
77

8-
use \Magento\Framework\Module\ModuleList;
8+
use Magento\Framework\Module\ModuleList;
9+
use PHPUnit\Framework\MockObject\MockObject;
10+
use PHPUnit\Framework\TestCase;
911

10-
class ModuleListTest extends \PHPUnit\Framework\TestCase
12+
/**
13+
* Test for module list
14+
*/
15+
class ModuleListTest extends TestCase
1116
{
1217
/**
1318
* Fixture for all modules' meta-information
@@ -24,12 +29,12 @@ class ModuleListTest extends \PHPUnit\Framework\TestCase
2429
private static $enabledFixture = ['foo' => 1, 'bar' => 0];
2530

2631
/**
27-
* @var \PHPUnit_Framework_MockObject_MockObject
32+
* @var MockObject
2833
*/
2934
private $config;
3035

3136
/**
32-
* @var \PHPUnit_Framework_MockObject_MockObject
37+
* @var MockObject
3338
*/
3439
private $loader;
3540

@@ -47,7 +52,6 @@ protected function setUp()
4752

4853
public function testGetAll()
4954
{
50-
$this->config->expects($this->once())->method('resetData');
5155
$this->setLoadAllExpectation();
5256
$this->setLoadConfigExpectation();
5357
$expected = ['foo' => self::$allFixture['foo']];
@@ -65,7 +69,6 @@ public function testGetAllNoData()
6569

6670
public function testGetOne()
6771
{
68-
$this->config->expects($this->once())->method('resetData');
6972
$this->setLoadAllExpectation();
7073
$this->setLoadConfigExpectation();
7174
$this->assertSame(['key' => 'value'], $this->model->getOne('foo'));
@@ -74,7 +77,6 @@ public function testGetOne()
7477

7578
public function testGetNames()
7679
{
77-
$this->config->expects($this->once())->method('resetData');
7880
$this->setLoadAllExpectation(false);
7981
$this->setLoadConfigExpectation();
8082
$this->assertSame(['foo'], $this->model->getNames());
@@ -83,7 +85,6 @@ public function testGetNames()
8385

8486
public function testHas()
8587
{
86-
$this->config->expects($this->once())->method('resetData');
8788
$this->setLoadAllExpectation(false);
8889
$this->setLoadConfigExpectation();
8990
$this->assertTrue($this->model->has('foo'));
@@ -92,7 +93,6 @@ public function testHas()
9293

9394
public function testIsModuleInfoAvailable()
9495
{
95-
$this->config->expects($this->once())->method('resetData');
9696
$this->setLoadConfigExpectation(true);
9797
$this->assertTrue($this->model->isModuleInfoAvailable());
9898
}

0 commit comments

Comments
 (0)