Skip to content

Commit ce1464e

Browse files
committed
#28579:DependencyTest does not analyze GraphQL schema files - fixed static and integration tests
1 parent a7037ce commit ce1464e

File tree

3 files changed

+15
-8
lines changed

3 files changed

+15
-8
lines changed

dev/tests/integration/testsuite/Magento/Framework/GraphQl/Config/GraphQlReaderTest.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,11 @@ protected function setUp(): void
4747
$fileResolverMock = $this->getMockBuilder(
4848
\Magento\Framework\Config\FileResolverInterface::class
4949
)->disableOriginalConstructor()->getMock();
50+
$filePath1 = __DIR__ . '/../_files/schemaA.graphqls';
51+
$filePath2 = __DIR__ . '/../_files/schemaB.graphqls';
5052
$fileList = [
51-
file_get_contents(__DIR__ . '/../_files/schemaA.graphqls'),
52-
file_get_contents(__DIR__ . '/../_files/schemaB.graphqls')
53+
$filePath1 => file_get_contents($filePath1),
54+
$filePath2 => file_get_contents($filePath2)
5355
];
5456
$fileResolverMock->expects($this->any())->method('get')->willReturn($fileList);
5557
$graphQlReader = $this->objectManager->create(
@@ -219,31 +221,31 @@ function ($a, $b) {
219221
}
220222
//Checks to make sure that the given description exists in the expectedOutput array
221223
$this->assertArrayHasKey(
222-
224+
223225
array_search(
224226
'Comment for empty PhysicalProductInterface',
225227
array_column($expectedOutput, 'description')
226228
),
227229
$expectedOutput
228-
230+
229231
);
230232
$this->assertArrayHasKey(
231-
233+
232234
array_search(
233235
'Comment for empty Enum',
234236
array_column($expectedOutput, 'description')
235237
),
236238
$expectedOutput
237-
239+
238240
);
239241
$this->assertArrayHasKey(
240-
242+
241243
array_search(
242244
'Comment for SearchResultPageInfo',
243245
array_column($expectedOutput, 'description')
244246
),
245247
$expectedOutput
246-
248+
247249
);
248250
}
249251
}

dev/tests/integration/testsuite/Magento/Framework/GraphQl/GraphQlConfigTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,12 @@ protected function setUp(): void
4848
['fileResolver' => $fileResolverMock]
4949
);
5050
$reader = $objectManager->create(
51+
// phpstan:ignore
5152
\Magento\Framework\GraphQlSchemaStitching\Reader::class,
5253
['readers' => ['graphql_reader' => $graphQlReader]]
5354
);
5455
$data = $objectManager->create(
56+
// phpstan:ignore
5557
\Magento\Framework\GraphQl\Config\Data ::class,
5658
['reader' => $reader]
5759
);

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public function getDeclaredExistingModuleDependencies(string $moduleName): array
6767
foreach ($dependencies as $dependency) {
6868
$checkResult = array_intersect($declared, $dependency);
6969
if ($checkResult) {
70+
//phpcs:ignore Magento2.Performance.ForeachArrayMerge
7071
$existingDeclared = array_merge($existingDeclared, array_values($checkResult));
7172
}
7273
}
@@ -161,6 +162,7 @@ private function filterComplexDependency(string $moduleName, array $modules): ar
161162
} else {
162163
foreach ($modules as $dependencySet) {
163164
if (array_search($moduleName, $dependencySet) === false) {
165+
//phpcs:ignore Magento2.Performance.ForeachArrayMerge
164166
$resultDependencies = array_merge(
165167
$resultDependencies,
166168
$dependencySet
@@ -406,6 +408,7 @@ private function getConstraintDependencies(array $moduleDeclaration): array
406408
$this->getDependencyId($tableName, self::SCHEMA_ENTITY_CONSTRAINT, $constraintName);
407409
switch ($constraintDeclaration['type']) {
408410
case 'foreign':
411+
//phpcs:ignore Magento2.Performance.ForeachArrayMerge
409412
$constraintDependencies = array_merge(
410413
$constraintDependencies,
411414
$this->getFKDependencies($constraintDeclaration)

0 commit comments

Comments
 (0)