Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ActionGroupDomTest.php
Go to the documentation of this file.
1 <?php
7 
12 
14 {
19  {
20  $sampleXml = "<actionGroups>
21  <actionGroup name=\"actionGroupWithoutArguments\">
22  <wait time=\"1\" stepKey=\"waitForNothing\" />
23  <wait time=\"2\" stepKey=\"waitForNothing\" />
24  </actionGroup>
25  </actionGroups>";
26 
27  $exceptionCollector = new ExceptionCollector();
28  new ActionGroupDom($sampleXml, 'dupeStepKeyActionGroup.xml', $exceptionCollector);
29 
30  $this->expectException(\Exception::class);
31  $exceptionCollector->throwException();
32  }
33 
38  {
39  $sampleXml = "<actionGroups>
40  <actionGroup name=\"sampleActionGroup\">
41  <wait>
42  </actionGroup>
43  </actionGroups>";
44 
45  $exceptionCollector = new ExceptionCollector();
46  $this->expectException(ValidationException::class);
47  $this->expectExceptionMessage("XML Parse Error: invalid.xml\n");
48  new ActionGroupDom($sampleXml, 'invalid.xml', $exceptionCollector);
49  }
50 
55  {
56  $sampleXml = '<actionGroups>
57  <actionGroup name="actionGroupName">
58  <wait time="1" stepKey="key1" />
59  </actionGroup>
60  <actionGroup name="actionGroupName">
61  <wait time="1" stepKey="key1" />
62  </actionGroup>
63  </actionGroups>';
64 
65  $exceptionCollector = new ExceptionCollector();
66  new ActionGroupDom($sampleXml, 'dupeNameActionGroup.xml', $exceptionCollector);
67  $this->expectException(\Exception::class);
68  $this->expectExceptionMessageRegExp("/name: actionGroupName is used more than once./");
69  $exceptionCollector->throwException();
70  }
71 }