forked from magento/magento2-phpstorm-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBaseInspectionsTestCase.java
52 lines (44 loc) · 1.85 KB
/
BaseInspectionsTestCase.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
package com.magento.idea.magento2plugin.inspections;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
import com.magento.idea.magento2plugin.BaseProjectTestCase;
import com.magento.idea.magento2plugin.bundles.InspectionBundle;
import java.util.List;
/**
* Configure test environment with Magento 2 project
*/
abstract public class BaseInspectionsTestCase extends BaseProjectTestCase {
protected final InspectionBundle inspectionBundle = new InspectionBundle();
protected void assertHasHighlighting(String message) {
String highlightingNotFound = "Failed that documents contains highlighting with the description `%s`";
List<HighlightInfo> highlightingList = myFixture.doHighlighting();
if (highlightingList.isEmpty()) {
fail(String.format(highlightingNotFound, message));
}
for (HighlightInfo highlighting :
highlightingList) {
if (highlighting.getDescription() == null) continue;
if (highlighting.getDescription().equals(message)) {
return;
}
}
fail(String.format(highlightingNotFound, message));
}
protected void assertHasNoHighlighting(String message) {
String highlightingNotFound = "Failed that documents not contains highlighting with the description `%s`";
List<HighlightInfo> highlightingList = myFixture.doHighlighting();
if (highlightingList.isEmpty()) {
return;
}
for (HighlightInfo highlighting :
highlightingList) {
if (highlighting.getDescription() == null) continue;
if (highlighting.getDescription().equals(message)) {
fail(String.format(highlightingNotFound, message));
}
}
}
}