File tree Expand file tree Collapse file tree 2 files changed +46
-0
lines changed
testData/actions/generation/generator/QueueCommunicationGenerator/generateCommunicationXmlFile
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 2 files changed +46
-0
lines changed Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" ?>
2+ <config xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
3+ xsi : noNamespaceSchemaLocation =" urn:magento:framework:Communication/etc/communication.xsd" >
4+ <topic name =" topic.name" request =" string" response =" string" >
5+ <handler name =" handlerName" type =" Foo\Bar\Model\Handler" method =" execute" />
6+ </topic >
7+ </config >
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 .NewMessageQueueAction ;
6+ import com .magento .idea .magento2plugin .actions .generation .data .QueueCommunicationData ;
7+ import com .magento .idea .magento2plugin .magento .files .QueueCommunicationXml ;
8+
9+ public class QueueCommunicationGeneratorTest extends BaseGeneratorTestCase {
10+ private static final String TOPIC_NAME = "topic.name" ;
11+ private static final String HANDLER_NAME = "handlerName" ;
12+ private static final String HANDLER_TYPE = "Foo\\ Bar\\ Model\\ Handler" ;
13+ private static final String HANDLER_METHOD = "execute" ;
14+ private static final String MODULE_NAME = "Foo_Bar" ;
15+ private static final String EXPECTED_DIRECTORY = "src/app/code/Foo/Bar/etc" ;
16+
17+ /**
18+ * Tests for generation of communication.xml file.
19+ */
20+ public void testGenerateCommunicationXmlFile () {
21+ final String filePath = this .getFixturePath (QueueCommunicationXml .fileName );
22+ final PsiFile expectedFile = myFixture .configureByFile (filePath );
23+ final Project project = myFixture .getProject ();
24+ final QueueCommunicationGenerator communicationGenerator = new QueueCommunicationGenerator (
25+ project ,
26+ new QueueCommunicationData (
27+ TOPIC_NAME ,
28+ HANDLER_NAME ,
29+ HANDLER_TYPE ,
30+ HANDLER_METHOD ,
31+ MODULE_NAME
32+ )
33+ );
34+
35+ final PsiFile file = communicationGenerator .generate (NewMessageQueueAction .ACTION_NAME );
36+
37+ assertGeneratedFileIsCorrect (expectedFile , EXPECTED_DIRECTORY , file );
38+ }
39+ }
You can’t perform that action at this time.
0 commit comments