File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
testData/actions/generation/generator/ModuleViewModelClassGenerator/generateViewModelFile
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Foo \Bar \ViewModel ;
4
+
5
+ use Magento \Framework \View \Element \Block \ArgumentInterface ;
6
+
7
+ class TestViewModel implements ArgumentInterface
8
+ {
9
+
10
+ }
Original file line number Diff line number Diff line change
1
+ package com .magento .idea .magento2plugin .actions .generation .generator ;
2
+
3
+ import com .intellij .openapi .project .Project ;
4
+ import com .intellij .psi .PsiFile ;
5
+ import com .magento .idea .magento2plugin .actions .generation .data .ViewModelFileData ;
6
+
7
+ public class ModuleViewModelClassGeneratorTest extends BaseGeneratorTestCase {
8
+
9
+ public void testGenerateViewModelFile () {
10
+ Project project = myFixture .getProject ();
11
+
12
+ ViewModelFileData viewModelData = new ViewModelFileData (
13
+ "ViewModel" ,
14
+ "TestViewModel" ,
15
+ "Foo_Bar" ,
16
+ "Foo\\ Bar\\ ViewModel"
17
+ );
18
+ ModuleViewModelClassGenerator moduleViewModelClassGenerator = new ModuleViewModelClassGenerator (
19
+ viewModelData ,
20
+ project
21
+ );
22
+ PsiFile viewModelFile = moduleViewModelClassGenerator .generate ("test" );
23
+
24
+ String filePath = this .getFixturePath ("TestViewModel.php" );
25
+ PsiFile expectedFile = myFixture .configureByFile (filePath );
26
+
27
+ assertGeneratedFileIsCorrect (
28
+ expectedFile ,
29
+ "src/app/code/Foo/Bar/ViewModel" ,
30
+ viewModelFile
31
+ );
32
+ }
33
+ }
You can’t perform that action at this time.
0 commit comments