@@ -26,6 +26,7 @@ public void testGeneratePreferenceClassFile() {
26
26
"SimpleModelOneOverride" ,
27
27
"Foo\\ Bar\\ Model\\ Override\\ SimpleModelOneOverride" ,
28
28
"Foo\\ Bar\\ Model\\ Override" ,
29
+ false ,
29
30
false
30
31
);
31
32
final String filePath = this .getFixturePath ("SimpleModelOneOverride.php" );
@@ -38,6 +39,29 @@ public void testGeneratePreferenceClassFile() {
38
39
);
39
40
}
40
41
42
+ /**
43
+ * Test preference class file generation.
44
+ */
45
+ public void testGeneratePreferenceInterfaceFile () {
46
+ final PsiFile preferenceClassFile = createPreferenceClassFile (
47
+ TARGET_MODEL_ONE_CLASS_FQN ,
48
+ "Model" ,
49
+ "InterfaceOverride" ,
50
+ "Foo\\ Bar\\ Model\\ InterfaceOverride" ,
51
+ "Foo\\ Bar\\ Model" ,
52
+ false ,
53
+ true
54
+ );
55
+ final String filePath = this .getFixturePath ("InterfaceOverride.php" );
56
+ final PsiFile expectedFile = myFixture .configureByFile (filePath );
57
+
58
+ assertGeneratedFileIsCorrect (
59
+ expectedFile ,
60
+ "src/app/code/Foo/Bar/Model" ,
61
+ preferenceClassFile
62
+ );
63
+ }
64
+
41
65
/**
42
66
* Test preference class file generation with inheritance.
43
67
*/
@@ -48,7 +72,8 @@ public void testGeneratePreferenceClassFileWithInheritance() {
48
72
"SimpleModelTwoOverride" ,
49
73
"Foo\\ Bar\\ Model\\ Override\\ SimpleModelTwoOverride" ,
50
74
"Foo\\ Bar\\ Model\\ Override" ,
51
- true
75
+ true ,
76
+ false
52
77
);
53
78
final String filePath = this .getFixturePath ("SimpleModelTwoOverride.php" );
54
79
final PsiFile expectedFile = myFixture .configureByFile (filePath );
@@ -77,7 +102,8 @@ private PsiFile createPreferenceClassFile(
77
102
final String preferenceClassName ,
78
103
final String preferenceFqn ,
79
104
final String namespace ,
80
- final Boolean inheritClass
105
+ final Boolean inheritClass ,
106
+ final Boolean isInterface
81
107
) {
82
108
final Project project = myFixture .getProject ();
83
109
final PhpClass targetClass = GetPhpClassByFQN .getInstance (project ).execute (targetClassFnq );
@@ -88,7 +114,8 @@ private PsiFile createPreferenceClassFile(
88
114
targetClass ,
89
115
preferenceFqn ,
90
116
namespace ,
91
- inheritClass
117
+ inheritClass ,
118
+ isInterface
92
119
);
93
120
final PreferenceClassGenerator preferenceClassGenerator = new PreferenceClassGenerator (
94
121
preferenceFileData ,
0 commit comments