Skip to content

Commit 3b84770

Browse files
committed
MQE-386: MFTF Compatability with Windows Machine
- changes to test suite in order to account for os pathing in verification tests - add .gitattributes to the mftf
1 parent d76e7ae commit 3b84770

File tree

5 files changed

+62
-10
lines changed

5 files changed

+62
-10
lines changed

Diff for: .gitattributes

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Declare files that will always have LF line endings on checkout.
2+
dev/tests/verification/Resources/TestSuiteGeneration1.txt text=auto !eol
3+
dev/tests/verification/Resources/*.txt text eol=lf

Diff for: bin/phpunit-checks.bat

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
:: Copyright © Magento, Inc. All rights reserved.
2+
:: See COPYING.txt for license details.
3+
4+
@echo ===============================UNIT TESTS===============================
5+
@echo off
6+
call vendor\bin\phpunit --configuration dev\tests\phpunit.xml --testsuite unit --coverage-xml build\coverage-xml
7+
8+
@echo off
9+
@echo ===============================VERIFICATION TESTS===============================
10+
call vendor\bin\phpunit --configuration dev\tests\phpunit.xml --testsuite verification --coverage-xml build\coverage-xml

Diff for: bin/static-checks.bat

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:: Copyright © Magento, Inc. All rights reserved.
2+
:: See COPYING.txt for license details.
3+
4+
@echo off
5+
@echo ===============================PHP CODE SNIFFER REPORT===============================
6+
call vendor\bin\phpcs .\src --standard=.\dev\tests\static\Magento
7+
call vendor\bin\phpcs .\dev\tests\unit --standard=.\dev\tests\static\Magento
8+
call vendor\bin\phpcs .\dev\tests\verification --standard=.\dev\tests\static\Magento --ignore=dev\tests\verification\_generated
9+
10+
@echo ===============================COPY PASTE DETECTOR REPORT===============================
11+
call vendor\bin\phpcpd .\src
12+
13+
:: Uncomment lines as part of MQE-590
14+
:: @echo "===============================PHP MESS DETECTOR REPORT===============================
15+
:: vendor\bin\phpmd .\src text \dev\tests\static\Magento\CodeMessDetector\ruleset.xml --exclude _generated
16+
17+
@echo ===============================MAGENTO COPYRIGHT REPORT===============================
18+
echo msgbox "INFO:Copyright check currently not run as part of .bat implementation" > "%temp%\popup.vbs"
19+
wscript.exe "%temp%\popup.vbs"
20+
::bin\copyright-check

Diff for: dev/tests/verification/Resources/TestSuiteGeneration1.txt

-4
This file was deleted.

Diff for: dev/tests/verification/Tests/SuiteGenerationTest.php

+29-6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ class SuiteGenerationTest extends TestCase
1616
const RESOURCES_DIR = TESTS_BP . DIRECTORY_SEPARATOR . 'verification' . DIRECTORY_SEPARATOR . 'Resources';
1717
const CONFIG_YML_FILE = FW_BP . DIRECTORY_SEPARATOR . SuiteGenerator::YAML_CODECEPTION_CONFIG_FILENAME;
1818

19+
const MANIFEST_RESULTS = [
20+
'SampleSuite3Cest.php:IncludeTest',
21+
'SampleSuite5Cest.php:additionalTest',
22+
'SampleSuiteCest.php:IncludeTest',
23+
'SampleSuite4Cest.php:IncludeTest'
24+
];
25+
1926
private static $YML_EXISTS_FLAG = false;
2027
private static $TEST_GROUPS = [];
2128

@@ -45,18 +52,34 @@ public function testSuiteGeneration1()
4552
$yml = Yaml::parse(file_get_contents(self::CONFIG_YML_FILE));
4653
$this->assertArrayHasKey($groupName, $yml['groups']);
4754

48-
// Validate test manifest contents
49-
$actualManifest = TESTS_BP .
55+
$suiteResultBaseDir = TESTS_BP .
5056
DIRECTORY_SEPARATOR .
5157
"verification" .
5258
DIRECTORY_SEPARATOR .
5359
"_generated" .
5460
DIRECTORY_SEPARATOR .
5561
$groupName .
56-
DIRECTORY_SEPARATOR .
57-
TestManifest::TEST_MANIFEST_FILENAME;
58-
$expectedManifest = self::RESOURCES_DIR . DIRECTORY_SEPARATOR . "TestSuiteGeneration1.txt";
59-
$this->assertFileEquals($expectedManifest, $actualManifest, '', true, true);
62+
DIRECTORY_SEPARATOR;
63+
64+
// Validate test manifest contents
65+
$actualManifest = $suiteResultBaseDir . TestManifest::TEST_MANIFEST_FILENAME;
66+
$actualTestReferences = explode(PHP_EOL, file_get_contents($actualManifest));
67+
68+
for ($i = 0; $i < count($actualTestReferences); $i++) {
69+
if (empty($actualTestReferences[$i])) {
70+
continue;
71+
}
72+
73+
$this->assertStringEndsWith(self::MANIFEST_RESULTS[$i], $actualTestReferences[$i]);
74+
$this->assertNotFalse(strpos($actualTestReferences[$i], $groupName));
75+
}
76+
77+
// Validate expected php files exist
78+
foreach (self::MANIFEST_RESULTS as $expectedTestReference) {
79+
$cestName = explode(":", $expectedTestReference, 2);
80+
$this->assertFileExists($suiteResultBaseDir . $cestName[0]);
81+
}
82+
6083
}
6184

6285
public static function tearDownAfterClass()

0 commit comments

Comments
 (0)