Definition at line 12 of file ControllerAclTest.php.
◆ setUp()
Set up before test execution.
Definition at line 46 of file ControllerAclTest.php.
48 $whitelistedClasses = [];
49 $path = sprintf(
'%s/_files/controller_acl_test_whitelist_*.txt',
__DIR__);
50 foreach (glob(
$path) as $listFile) {
51 $whitelistedClasses = array_merge(
53 file($listFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES)
56 foreach ($whitelistedClasses as
$item) {
57 if (substr(
$item, 0, 1) ===
'#') {
60 $this->whiteListedBackendControllers[
$item] = 1;
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ testAcl()
Test ACL in the admin area by various assertions.
Definition at line 67 of file ControllerAclTest.php.
70 $pathMask = sprintf(
'%s/../../../_files/changed_files*',
__DIR__, DIRECTORY_SEPARATOR);
73 $relativeFilePath = $line[0];
75 if ($this->isItTest($relativeFilePath)) {
79 $controllerPath = $this->getControllerPath($relativeFilePath);
80 if (!$controllerPath) {
84 $controllerClass = $this->getClassByFilePath($controllerPath);
86 if (isset($this->whiteListedBackendControllers[$controllerClass->getName()])) {
90 if ($controllerClass->isAbstract()) {
96 if (!$this->isClassExtendsBackendClass($controllerClass)) {
97 $inheritanceMessage =
"Backend controller $className have to inherit " . AbstractAction::class;
98 $errorMessages[] = $inheritanceMessage;
102 $isAclRedefinedInTheChildClass = $this->isConstantOverwritten($controllerClass)
103 || $this->isMethodOverwritten($controllerClass);
104 if (!$isAclRedefinedInTheChildClass) {
105 $errorMessages[] =
"Backend controller $className have to overwrite _isAllowed method or " 106 .
'ADMIN_RESOURCE constant';
109 $errorMessages = array_merge($errorMessages, $this->collectAclErrorsInTheXml($controllerClass));
111 sort($errorMessages);
112 $this->assertEmpty($errorMessages, implode(
"\n", $errorMessages));
static getPhpFiles($changedFilesList, $fileTypes=0)
defined('TESTS_BP')||define('TESTS_BP' __DIR__
◆ ACL_CONST_NAME
const ACL_CONST_NAME = 'ADMIN_RESOURCE' |
◆ ACL_FUNC_NAME
const ACL_FUNC_NAME = '_isAllowed' |
Default function for checking accessibility of the ACL resource.
Definition at line 17 of file ControllerAclTest.php.
◆ DEFAULT_BACKEND_RESOURCE
const DEFAULT_BACKEND_RESOURCE = 'Magento_Backend::admin' |
The documentation for this class was generated from the following file:
- vendor/magento/magento2-base/dev/tests/static/testsuite/Magento/Test/Integrity/Magento/Backend/ControllerAclTest.php