12
12
use Magento \FunctionalTestingFramework \Test \Objects \TestObject ;
13
13
use Magento \FunctionalTestingFramework \Util \MagentoTestCase ;
14
14
use Magento \FunctionalTestingFramework \Util \TestGenerator ;
15
+ use Magento \FunctionalTestingFramework \Config \MftfApplicationConfig ;
16
+ use Magento \FunctionalTestingFramework \ObjectManager ;
17
+ use Magento \FunctionalTestingFramework \ObjectManagerFactory ;
15
18
16
19
class TestGeneratorTest extends MagentoTestCase
17
20
{
@@ -38,4 +41,51 @@ public function testEntityException()
38
41
39
42
$ testGeneratorObject ->createAllTestFiles (null , []);
40
43
}
44
+
45
+ /**
46
+ * Tests that skipped tests do not have a fully generated body
47
+ *
48
+ * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
49
+ */
50
+ public function testSkippedNoGeneration ()
51
+ {
52
+ $ actionInput = 'fakeInput ' ;
53
+ $ actionObject = new ActionObject ('fakeAction ' , 'comment ' , [
54
+ 'userInput ' => $ actionInput
55
+ ]);
56
+
57
+ $ annotations = ['skip ' => ['issue ' ]];
58
+ $ testObject = new TestObject ("sampleTest " , ["merge123 " => $ actionObject ], $ annotations , [], "filename " );
59
+
60
+ $ testGeneratorObject = TestGenerator::getInstance ("" , ["sampleTest " => $ testObject ]);
61
+ $ output = $ testGeneratorObject ->assembleTestPhp ($ testObject );
62
+
63
+ $ this ->assertContains ('This test is skipped ' , $ output );
64
+ $ this ->assertNotContains ( $ actionInput , $ output );
65
+ }
66
+
67
+ /**
68
+ * Tests that skipped tests have a fully generated body when --allowSkipped is passed in
69
+ *
70
+ * @throws \Magento\FunctionalTestingFramework\Exceptions\TestReferenceException
71
+ */
72
+ public function testAllowSkipped ()
73
+ {
74
+ // Mock allowSkipped for TestGenerator
75
+ AspectMock::double (MftfApplicationConfig::class, ['allowSkipped ' => true ]);
76
+
77
+ $ actionInput = 'fakeInput ' ;
78
+ $ actionObject = new ActionObject ('fakeAction ' , 'comment ' , [
79
+ 'userInput ' => $ actionInput
80
+ ]);
81
+
82
+ $ annotations = ['skip ' => ['issue ' ]];
83
+ $ testObject = new TestObject ("sampleTest " , ["merge123 " => $ actionObject ], $ annotations , [], "filename " );
84
+
85
+ $ testGeneratorObject = TestGenerator::getInstance ("" , ["sampleTest " => $ testObject ]);
86
+ $ output = $ testGeneratorObject ->assembleTestPhp ($ testObject );
87
+
88
+ $ this ->assertNotContains ('This test is skipped ' , $ output );
89
+ $ this ->assertContains ($ actionInput , $ output );
90
+ }
41
91
}
0 commit comments