|
14 | 14 | use Magento\FunctionalTestingFramework\Util\MagentoTestCase;
|
15 | 15 | use Magento\FunctionalTestingFramework\Util\TestGenerator;
|
16 | 16 | use Magento\FunctionalTestingFramework\Config\MftfApplicationConfig;
|
| 17 | +use Magento\FunctionalTestingFramework\Exceptions\TestReferenceException; |
17 | 18 |
|
18 | 19 | class TestGeneratorTest extends MagentoTestCase
|
19 | 20 | {
|
@@ -41,11 +42,36 @@ public function testEntityException()
|
41 | 42 | $testGeneratorObject->createAllTestFiles(null, []);
|
42 | 43 | }
|
43 | 44 |
|
| 45 | + /** |
| 46 | + * Test to check exceptions for createData on referencing non-existent entity |
| 47 | + * |
| 48 | + * @throws TestReferenceException |
| 49 | + */ |
| 50 | + |
| 51 | + public function testCreateDataException() |
| 52 | + { |
| 53 | + $actionObject = new ActionObject('fakeAction', 'createData', [ |
| 54 | + 'entity' => 'invalidEntity' |
| 55 | + ]); |
| 56 | + |
| 57 | + $testObject = new TestObject("sampleTest", ["merge123" => $actionObject], [], [], "filename"); |
| 58 | + |
| 59 | + $testGeneratorObject = TestGenerator::getInstance("", ["sampleTest" => $testObject]); |
| 60 | + |
| 61 | + AspectMock::double(TestGenerator::class, ['loadAllTestObjects' => ["sampleTest" => $testObject]]); |
| 62 | + |
| 63 | + $this->expectExceptionMessage("Entity \"invalidEntity\" does not exist." . |
| 64 | + "\nException occurred parsing action at StepKey \"fakeAction\" in Test \"sampleTest\""); |
| 65 | + |
| 66 | + $testGeneratorObject->createAllTestFiles(null, []); |
| 67 | + } |
| 68 | + |
44 | 69 | /**
|
45 | 70 | * Tests that skipped tests do not have a fully generated body
|
46 | 71 | *
|
47 | 72 | * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
|
48 | 73 | */
|
| 74 | + |
49 | 75 | public function testSkippedNoGeneration()
|
50 | 76 | {
|
51 | 77 | $actionInput = 'fakeInput';
|
|
0 commit comments