Skip to content

Commit 16727bc

Browse files
committed
Added test for disabled observer inspection warning
1 parent 7b19f16 commit 16727bc

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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>
9+
<event name="test_event_in_test_class">
10+
<observer name=<warning descr="This observer does not exist to be disabled. For more details, see Inspection Description.">"test_non_existing_observer"</warning>
11+
instance="Magento\Catalog\Observer\TestObserver"
12+
disabled="true"/>
13+
</event>
14+
</config>

tests/com/magento/idea/magento2plugin/inspections/xml/ObserverDeclarationInspectionTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,12 @@ public void testObserverNameUsedInDifferentFile() {
3131
myFixture.configureByFile(getFixturePath(ModuleEventsXml.FILE_NAME));
3232
myFixture.testHighlighting(true, false, false);
3333
}
34+
35+
/**
36+
* Tests warning for disabling of non-existing observer.
37+
*/
38+
public void testDisablingNonExistingObserver() {
39+
myFixture.configureByFile(getFixturePath(ModuleEventsXml.FILE_NAME));
40+
myFixture.testHighlighting(true, false, false);
41+
}
3442
}

0 commit comments

Comments
 (0)