77
88namespace Magento \SemanticVersionChecker \Test \Unit \Console \Command ;
99
10- use Magento \SemanticVersionChecker \Test \Unit \Console \Command \CompareSourceCommandTest \AbstractTestCase ;
10+ use Magento \SemanticVersionChecker \Test \Unit \Console \Command \CompareSourceCommandTest \AbstractTestCaseWithRegExp ;
1111
1212/**
1313 * Test semantic version checker CLI command dealing with di.xml
1414 */
15- class CompareSourceCommandDiXmlTest extends AbstractTestCase
15+ class CompareSourceCommandDiXmlTest extends AbstractTestCaseWithRegExp
1616{
1717 /**
1818 * Test semantic version checker CLI command for changes of the database schema.
@@ -21,7 +21,7 @@ class CompareSourceCommandDiXmlTest extends AbstractTestCase
2121 * @param string $pathToSourceCodeAfter
2222 * @param string[] $expectedLogEntries
2323 * @param string $expectedOutput
24- * @param string[] $unexpectedLogEntries
24+ * @param bool $shouldSkipTest
2525 * @return void
2626 * @throws \Exception
2727 * @dataProvider changesDataProvider
@@ -31,14 +31,14 @@ public function testExecute(
3131 $ pathToSourceCodeAfter ,
3232 $ expectedLogEntries ,
3333 $ expectedOutput ,
34- $ unexpectedLogEntries = []
34+ $ shouldSkipTest = false
3535 ) {
3636 $ this ->doTestExecute (
3737 $ pathToSourceCodeBefore ,
3838 $ pathToSourceCodeAfter ,
3939 $ expectedLogEntries ,
4040 $ expectedOutput ,
41- $ unexpectedLogEntries
41+ $ shouldSkipTest
4242 );
4343 }
4444
@@ -51,47 +51,55 @@ public function changesDataProvider()
5151 $ pathToFixtures . '/no-change/source-code-before ' ,
5252 $ pathToFixtures . '/no-change/source-code-after ' ,
5353 [
54-
54+ ' #Suggested semantic versioning change: NONE# ' ,
5555 ],
5656 ''
5757 ],
5858 'moved-to-global ' => [
5959 $ pathToFixtures . '/moved-to-global/source-code-before ' ,
6060 $ pathToFixtures . '/moved-to-global/source-code-after ' ,
6161 [
62- 'Suggested semantic versioning change: NONE ' ,
62+ '# Suggested semantic versioning change: NONE# ' ,
6363 ],
6464 'Patch change is detected. ' ,
6565 ],
6666 'moved-to-specific ' => [
6767 $ pathToFixtures . '/moved-to-specific/source-code-before ' ,
6868 $ pathToFixtures . '/moved-to-specific/source-code-after ' ,
6969 [
70- 'Suggested semantic versioning change: MAJOR ' ,
70+ '#Suggested semantic versioning change: MAJOR# ' ,
71+ '#MAJOR\s*\|\s*Console/Command/CompareSourceCommandTest/_files/di_xml/moved-to-specific/source-code-before/Magento/TestModule/etc/di\.xml:0# ' ,
72+ '#scope\s*\|\s*Virtual Type was changed\s*\|\s*M201# '
7173 ],
7274 'Major change is detected. ' ,
7375 ],
7476 'remove-type ' => [
7577 $ pathToFixtures . '/remove-type/source-code-before ' ,
7678 $ pathToFixtures . '/remove-type/source-code-after ' ,
7779 [
78- 'Suggested semantic versioning change: MAJOR ' ,
80+ '#Suggested semantic versioning change: MAJOR# ' ,
81+ '#MAJOR\s*\|\s*Console/Command/CompareSourceCommandTest/_files/di_xml/remove-type/source-code-before/Magento/TestModule/etc/di\.xml:0# ' ,
82+ '#customCacheInstance2\s*\|\s*Virtual Type was removed\s*\|\s*M200\s*# '
7983 ],
8084 'Major change is detected. ' ,
8185 ],
8286 'change-type ' => [
8387 $ pathToFixtures . '/change-type/source-code-before ' ,
8488 $ pathToFixtures . '/change-type/source-code-after ' ,
8589 [
86- 'Suggested semantic versioning change: MAJOR ' ,
90+ '#Suggested semantic versioning change: MAJOR# ' ,
91+ '#MAJOR\s*\|\s*Console/Command/CompareSourceCommandTest/_files/di_xml/change-type/source-code-before/Magento/TestModule/etc/di\.xml:0# ' ,
92+ '#type\s*\|\s*Virtual Type was changed\s*\|\s*M201# '
8793 ],
8894 'Major change is detected. ' ,
8995 ],
9096 'change-name ' => [
91- $ pathToFixtures . '/change-type /source-code-before ' ,
92- $ pathToFixtures . '/change-type /source-code-after ' ,
97+ $ pathToFixtures . '/change-name /source-code-before ' ,
98+ $ pathToFixtures . '/change-name /source-code-after ' ,
9399 [
94- 'Suggested semantic versioning change: MAJOR ' ,
100+ '#Suggested semantic versioning change: MAJOR# ' ,
101+ '#MAJOR\s*\|\s*Console/Command/CompareSourceCommandTest/_files/di_xml/change-name/source-code-before/Magento/TestModule/etc/di\.xml:0# ' ,
102+ '#cacheInstance\s*\|\s*Virtual Type was removed\s*\|\s*M200# '
95103 ],
96104 'Major change is detected. ' ,
97105 ],
0 commit comments