Tests to find usage of restricted code
Definition at line 13 of file RestrictedCodeTest.php.
◆ _loadData()
static _loadData |
( |
array & |
$data, |
|
|
|
$filePattern |
|
) |
| |
|
staticprotected |
Loads and merges data from fixtures
- Parameters
-
array | $data | |
string | $filePattern | |
- Returns
- void
Definition at line 57 of file RestrictedCodeTest.php.
59 foreach (glob(
__DIR__ .
'/_files/' . $filePattern) as $file) {
63 str_replace(
BP . DIRECTORY_SEPARATOR,
'', $file)
66 $data = array_merge_recursive(
$data, self::_readList($file));
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ _readList()
static _readList |
( |
|
$file | ) |
|
|
staticprotected |
Isolate including a file into a method to reduce scope
- Parameters
-
- Returns
- array
Definition at line 76 of file RestrictedCodeTest.php.
◆ _testRestrictedClasses()
_testRestrictedClasses |
( |
|
$file | ) |
|
|
protected |
Assert that restricted classes are not used in the file
- Parameters
-
- Returns
- void
Definition at line 109 of file RestrictedCodeTest.php.
112 foreach (self::$_classes as $restrictedClass => $classRules) {
113 foreach ($classRules[
'exclude'] as $skippedPathInfo) {
114 if (strpos($file, $this->getExcludedFilePath($skippedPathInfo)) === 0) {
120 \
Magento\TestFramework\Utility\CodeCheck::isClassUsed($restrictedClass,
$content),
122 "Class '%s' is restricted in %s. Suggested replacement: %s",
125 $classRules[
'replacement']
◆ setUp()
◆ setUpBeforeClass()
static setUpBeforeClass |
( |
| ) |
|
|
static |
Read fixtures into memory as arrays
- Returns
- void
Definition at line 45 of file RestrictedCodeTest.php.
static _loadData(array &$data, $filePattern)
◆ testPhpFiles()
Test that restricted entities are not used in PHP files
- Returns
- void
Definition at line 86 of file RestrictedCodeTest.php.
88 $invoker = new \Magento\Framework\App\Utility\AggregateInvoker($this);
90 foreach (self::$_fixtureFiles as $fixtureFile) {
91 if (array_key_exists($fixtureFile, $testFiles)) {
92 unset($testFiles[$fixtureFile]);
static getPhpFiles($changedFilesList, $fileTypes=0)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
_testRestrictedClasses($file)
The documentation for this class was generated from the following file: