File tree Expand file tree Collapse 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 Expand file tree Collapse file tree 4 files changed +42
-1
lines changed Original file line number Diff line number Diff line change @@ -75,8 +75,11 @@ public class PhpRegex {
7575 public static final String CLASS_NAME
7676 = "[A-Z][a-zA-Z0-9_\\ x7f-\\ xff]*" ;
7777
78+ public static final String DIR_NAME
79+ = "[a-zA-Z0-9_\\ x7f-\\ xff]*" ;
80+
7881 public static final String FQN
79- = CLASS_NAME + "(\\ \\ " + CLASS_NAME + ")*" ;
82+ = CLASS_NAME + "(\\ \\ " + DIR_NAME + ")*" + CLASS_NAME ;
8083 }
8184
8285 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() {
1818 assertHasReferencePhpClass ("Magento\\ Catalog\\ Observer\\ TestObserver" );
1919 }
2020
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+
2130 /**
2231 * Tests for event name reference in events.xml.
2332 */
You can’t perform that action at this time.
0 commit comments