Skip to content

Commit 5810c6e

Browse files
committed
AC-663: Create phpcs static check for ClassesTest::testPhpCode
1 parent 717c998 commit 5810c6e

File tree

3 files changed

+44
-2
lines changed

3 files changed

+44
-2
lines changed

Magento2/Sniffs/Legacy/ClassesConfigurationSniff.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,15 @@ private function collectClassesInConfig(SimpleXMLElement $xml): array
128128
/config//resource_adapter | /config/*[not(name()="sections")]//class[not(ancestor::observers)]
129129
| //model[not(parent::connection)] | //backend_model | //source_model | //price_model
130130
| //model_token | //writer_model | //clone_model | //frontend_model | //working_model
131-
| //admin_renderer | //renderer | /config/*/di/preferences/*'
131+
| //admin_renderer | //renderer'
132132
);
133133
$classes = array_merge($classes, $this->getXmlAttributeValues($xml, '//@backend_model', 'backend_model'));
134+
$classes = array_merge($classes, $this->getXmlAttributeValues($xml, '/config//preference', 'type'));
134135
$classes = array_merge(
135136
$classes,
136137
$this->getXmlNodeNames(
137138
$xml,
138-
'/logging/*/expected_models/* | /logging/*/actions/*/expected_models/* | /config/*/di/preferences/*'
139+
'/logging/*/expected_models/* | /logging/*/actions/*/expected_models/*'
139140
)
140141
);
141142

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<preference for="DateTimeInterface" type="DateTime" />
10+
<preference for="Psr\Log\LoggerInterface" type="Magento\FRAMEWORK\Logger\LoggerProxy" />
11+
<preference for="Magento\Framework\EntityManager\EntityMetadataInterface" type="Magento\Framework\EntityManager\EntityMetadata" />
12+
<preference for="Magento\Framework\EntityManager\HydratorInterface" type="Magento\Framework\EntityManager\Hydrator" />
13+
<preference for="Magento\Framework\View\Template\Html\MinifierInterface" type="Magento\Framework\View\Template\Html\Minifier" />
14+
<preference for="Magento\Framework\Model\Entity\ScopeInterface" type="Magento\Framework\Model\Entity\Scope" />
15+
<type name="Magento\Store\Model\Store">
16+
<arguments>
17+
<argument name="currencyInstalled" xsi:type="string">system/currency/installed</argument>
18+
</arguments>
19+
</type>
20+
<virtualType name="Magento\Framework\Communication\Config\Reader\XmlReader" type="Magento\Framework\Config\Reader\Filesystem">
21+
<arguments>
22+
<argument name="converter" xsi:type="object">Magento\Framework\Communication\Config\Reader\XmlReader\Converter</argument>
23+
<argument name="schemaLocator" xsi:type="object">Magento\Framework\Communication\Config\Reader\XmlReader\SchemaLocator</argument>
24+
<argument name="fileName" xsi:type="string">communication.xml</argument>
25+
<argument name="idAttributes" xsi:type="array">
26+
<item name="/config/topic" xsi:type="string">name</item>
27+
<item name="/config/topic/handler" xsi:type="string">name</item>
28+
</argument>
29+
</arguments>
30+
</virtualType>
31+
<type name="Magento\Framework\Logger\Handler\Syslog">
32+
<arguments>
33+
<argument name="ident" xsi:type="string">Magento</argument>
34+
</arguments>
35+
</type>
36+
</config>

Magento2/Tests/Legacy/ClassesConfigurationUnitTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ public function getErrorList($testFile = '')
3131
10 => 1,
3232
];
3333
}
34+
if ($testFile === 'ClassesConfigurationUnitTest.4.xml') {
35+
return [
36+
10 => 1,
37+
];
38+
}
3439
return [];
3540
}
3641

0 commit comments

Comments
 (0)