Skip to content

Commit 5e47d4a

Browse files
author
Volodymyr Kublytskyi
committed
MAGETWO-64523: Add static test on forbidden "final" keyword and eliminate it usage in code
- added doc blocks for new methods
1 parent ca32c20 commit 5e47d4a

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

dev/tests/static/testsuite/Magento/Test/Php/LiveCodeTest.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@ public static function getWhitelist($fileTypes = ['php'], $changedFilesBaseDir =
8585
return $targetFiles;
8686
}
8787

88+
/**
89+
* This method loads list of changed files.
90+
*
91+
* List may be generated by:
92+
* - dev/tests/static/get_github_changes.php utility (allow to generate diffs between branches),
93+
* - CLI command "git diff --name-only > dev/tests/static/testsuite/Magento/Test/_files/changed_files_local.txt",
94+
*
95+
* If no generated changed files list found "git diff" will be used to find not committed changed
96+
* (tests should be invoked from target gir repo).
97+
*
98+
* Note: "static" modifier used for compatibility with legacy implementation of self::getWhitelist method
99+
*
100+
* @param string $changedFilesBaseDir Base dir with previously generated list files
101+
* @return string[] List of changed files
102+
*/
88103
private static function getChangedFilesList($changedFilesBaseDir)
89104
{
90105
$changedFiles = [];
@@ -113,6 +128,21 @@ function (&$file) {
113128
return $changedFiles;
114129
}
115130

131+
/**
132+
* Filter list of files.
133+
*
134+
* File removed from list:
135+
* - if it not exists,
136+
* - if allowed types are specified and file has another type (extension),
137+
* - if allowed directories specified and file not located in one of them.
138+
*
139+
* Note: "static" modifier used for compatibility with legacy implementation of self::getWhitelist method
140+
*
141+
* @param string[] $files List of file paths to filter
142+
* @param string[] $allowedFileTypes List of allowed file extensions (pass empty array to allow all)
143+
* @param string[] $allowedDirectories List of allowed directories (pass empty array to allow all)
144+
* @return string[] Filtered file paths
145+
*/
116146
private static function filterFiles(array $files, array $allowedFileTypes, array $allowedDirectories)
117147
{
118148
if (empty($allowedFileTypes)) {

0 commit comments

Comments
 (0)