File tree 4 files changed +42
-1
lines changed
src/com/magento/idea/magento2plugin/util
project/magento2/vendor/magento/module-catalog/test_event
reference/xml/ObserverReferenceRegistrar/observerInstanceDirectorySnakeCaseMustHaveReference
tests/com/magento/idea/magento2plugin/reference/xml
4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,11 @@ public class PhpRegex {
75
75
public static final String CLASS_NAME
76
76
= "[A-Z][a-zA-Z0-9_\\ x7f-\\ xff]*" ;
77
77
78
+ public static final String DIR_NAME
79
+ = "[a-zA-Z0-9_\\ x7f-\\ xff]*" ;
80
+
78
81
public static final String FQN
79
- = CLASS_NAME + "(\\ \\ " + CLASS_NAME + ")*" ;
82
+ = CLASS_NAME + "(\\ \\ " + DIR_NAME + ")*" + CLASS_NAME ;
80
83
}
81
84
82
85
public static class XmlRegex {
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ namespace Magento \Catalog \test_event ;
8
+
9
+ use Magento \Framework \Event \ObserverInterface ;
10
+
11
+ class TestObserver implements ObserverInterface
12
+ {
13
+ public function execute ()
14
+ {
15
+ }
16
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!--
3
+ /**
4
+ * Copyright © Magento, Inc. All rights reserved.
5
+ * See COPYING.txt for license details.
6
+ */
7
+ -->
8
+
9
+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" xsi : noNamespaceSchemaLocation =" urn:magento:framework:Event/etc/events.xsd" >
10
+ <event name =" test_event" >
11
+ <observer name =" test_observer" instance =" Magento\Catalog\test_event\TestObserver<caret>" />
12
+ </event >
13
+ </config >
Original file line number Diff line number Diff line change @@ -18,6 +18,15 @@ public void testObserverInstanceMustHaveReference() {
18
18
assertHasReferencePhpClass ("Magento\\ Catalog\\ Observer\\ TestObserver" );
19
19
}
20
20
21
+ /**
22
+ * Tests for observer instance with snake case reference in events.xml.
23
+ */
24
+ public void testObserverInstanceDirectorySnakeCaseMustHaveReference () {
25
+ myFixture .configureByFile (this .getFixturePath (ModuleEventsXml .FILE_NAME ));
26
+
27
+ assertHasReferencePhpClass ("Magento\\ Catalog\\ test_event\\ TestObserver" );
28
+ }
29
+
21
30
/**
22
31
* Tests for event name reference in events.xml.
23
32
*/
You can’t perform that action at this time.
0 commit comments