Skip to content

Commit 0e32b44

Browse files
committed
#27952: missing store_name in GraphQL resolver - initDeclaredDependencies() fix
1 parent 26df598 commit 0e32b44

File tree

3 files changed

+27
-17
lines changed

3 files changed

+27
-17
lines changed

dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/DeclarativeSchemaDependencyProvider.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class DeclarativeSchemaDependencyProvider
5454
*/
5555
private $dependencyProvider;
5656

57+
/**
58+
* DeclarativeSchemaDependencyProvider constructor.
59+
* @param DependencyProvider $dependencyProvider
60+
*/
5761
public function __construct(DependencyProvider $dependencyProvider)
5862
{
5963
$this->dependencyProvider = $dependencyProvider;
@@ -68,7 +72,6 @@ public function __construct(DependencyProvider $dependencyProvider)
6872
*/
6973
public function getDeclaredExistingModuleDependencies(string $moduleName): array
7074
{
71-
$this->dependencyProvider->initDeclaredDependencies();
7275
$dependencies = $this->getDependenciesFromFiles($this->getSchemaFileNameByModuleName($moduleName));
7376
$dependencies = $this->filterSelfDependency($moduleName, $dependencies);
7477
$declared = $this->dependencyProvider->getDeclaredDependencies(
@@ -103,7 +106,6 @@ public function getDeclaredExistingModuleDependencies(string $moduleName): array
103106
*/
104107
public function getUndeclaredModuleDependencies(string $moduleName): array
105108
{
106-
$this->dependencyProvider->initDeclaredDependencies();
107109
$dependencies = $this->getDependenciesFromFiles($this->getSchemaFileNameByModuleName($moduleName));
108110
$dependencies = $this->filterSelfDependency($moduleName, $dependencies);
109111
return $this->collectDependencies($moduleName, $dependencies);

dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/DependencyProvider.php

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,13 @@ class DependencyProvider
3939
private $packageModuleMapping = [];
4040

4141
/**
42-
* Initialise map of dependencies.
43-
*
44-
* @throws \Magento\TestFramework\Inspection\Exception
42+
* DependencyProvider constructor.
4543
* @throws \Magento\Framework\Exception\LocalizedException
44+
* @throws \Magento\TestFramework\Inspection\Exception
4645
*/
47-
public function initDeclaredDependencies()
46+
public function __construct()
4847
{
49-
if (empty($this->mapDependencies)) {
50-
$jsonFiles = Files::init()->getComposerFiles(ComponentRegistrar::MODULE, false);
51-
foreach ($jsonFiles as $file) {
52-
$json = new \Magento\Framework\Config\Composer\Package($this->readJsonFile($file));
53-
$moduleName = $this->convertModuleName($json->get('name'));
54-
$require = array_keys((array)$json->get('require'));
55-
$this->presetDependencies($moduleName, $require, self::TYPE_HARD);
56-
}
57-
}
48+
$this->initDeclaredDependencies();
5849
}
5950

6051
/**
@@ -86,6 +77,25 @@ public function getDeclaredDependencies(string $module, string $type, string $ma
8677
return $this->mapDependencies[$module][$type][$mapType] ?? [];
8778
}
8879

80+
/**
81+
* Initialise map of dependencies.
82+
*
83+
* @throws \Magento\TestFramework\Inspection\Exception
84+
* @throws \Magento\Framework\Exception\LocalizedException
85+
*/
86+
private function initDeclaredDependencies()
87+
{
88+
if (empty($this->mapDependencies)) {
89+
$jsonFiles = Files::init()->getComposerFiles(ComponentRegistrar::MODULE, false);
90+
foreach ($jsonFiles as $file) {
91+
$json = new \Magento\Framework\Config\Composer\Package($this->readJsonFile($file));
92+
$moduleName = $this->convertModuleName($json->get('name'));
93+
$require = array_keys((array)$json->get('require'));
94+
$this->presetDependencies($moduleName, $require, self::TYPE_HARD);
95+
}
96+
}
97+
}
98+
8999
/**
90100
* Add dependencies to dependency list.
91101
*

dev/tests/static/testsuite/Magento/Test/Integrity/Dependency/GraphQlSchemaDependencyProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ public function __construct(DependencyProvider $dependencyProvider)
4848
*/
4949
public function getDeclaredExistingModuleDependencies(string $moduleName): array
5050
{
51-
$this->dependencyProvider->initDeclaredDependencies();
5251
$dependencies = $this->getDependenciesFromSchema($moduleName);
5352
$declared = $this->dependencyProvider->getDeclaredDependencies(
5453
$moduleName,
@@ -73,7 +72,6 @@ public function getDeclaredExistingModuleDependencies(string $moduleName): array
7372
*/
7473
public function getUndeclaredModuleDependencies(string $moduleName): array
7574
{
76-
$this->dependencyProvider->initDeclaredDependencies();
7775
$dependencies = $this->getDependenciesFromSchema($moduleName);
7876
return $this->collectDependencies($moduleName, $dependencies);
7977
}

0 commit comments

Comments
 (0)