File tree Expand file tree Collapse file tree 2 files changed +47
-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 +47
-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+ /*
2+ * Copyright © Magento, Inc. All rights reserved.
3+ * See COPYING.txt for license details.
4+ */
5+ package com .magento .idea .magento2plugin .actions .generation .generator ;
6+
7+ import com .intellij .openapi .project .Project ;
8+ import com .intellij .psi .PsiFile ;
9+ import com .magento .idea .magento2plugin .actions .generation .data .ViewModelFileData ;
10+
11+ public class ModuleViewModelClassGeneratorTest extends BaseGeneratorTestCase {
12+
13+ public void testGenerateViewModelFile () {
14+ Project project = myFixture .getProject ();
15+
16+ ViewModelFileData viewModelData = new ViewModelFileData (
17+ "ViewModel" ,
18+ "TestViewModel" ,
19+ "Foo_Bar" ,
20+ "Foo\\ Bar\\ ViewModel"
21+ );
22+ ModuleViewModelClassGenerator moduleViewModelClassGenerator = new ModuleViewModelClassGenerator (
23+ viewModelData ,
24+ project
25+ );
26+ PsiFile viewModelFile = moduleViewModelClassGenerator .generate ("test" );
27+
28+ String filePath = this .getFixturePath ("TestViewModel.php" );
29+ PsiFile expectedFile = myFixture .configureByFile (filePath );
30+
31+ assertGeneratedFileIsCorrect (
32+ expectedFile ,
33+ "src/app/code/Foo/Bar/ViewModel" ,
34+ viewModelFile
35+ );
36+ }
37+ }
You can’t perform that action at this time.
0 commit comments