@@ -274,6 +274,18 @@ public function testMvcSecurityAllowsControllerAttributeRolePolicy(): void
274274
275275 $ this ->assertTrue ($ security ->checkAcl ($ event , $ dispatcher ));
276276 }
277+
278+ public function testMvcSecuritySkipsControllerAttributesWhenDisabled (): void
279+ {
280+ [$ security , $ event , $ dispatcher ] = $ this ->createAttributeMvcSecurityFixture (['admin ' ], false );
281+
282+ $ dispatcher ->setActionName ('findWith ' );
283+
284+ $ this ->withoutPhpWarnings (function () use ($ security , $ event , $ dispatcher ): void {
285+ $ this ->assertFalse ($ security ->checkAcl ($ event , $ dispatcher ));
286+ });
287+ $ this ->assertSame ('not-found ' , $ dispatcher ->getActionName ());
288+ }
277289
278290 public function testToArray (): void
279291 {
@@ -412,7 +424,7 @@ public function getAclRoles(): array
412424 * 2: \PhalconKit\Mvc\Dispatcher
413425 * }
414426 */
415- private function createAttributeMvcSecurityFixture (array $ roles ): array
427+ private function createAttributeMvcSecurityFixture (array $ roles, bool $ attributes = true ): array
416428 {
417429 $ dispatcher = new \PhalconKit \Mvc \Dispatcher ();
418430 $ dispatcher ->setNamespaceName ('PhalconKit \\Tests \\Unit \\Mvc \\Controller \\Traits \\Fixtures ' );
@@ -421,6 +433,9 @@ private function createAttributeMvcSecurityFixture(array $roles): array
421433
422434 $ di = new \Phalcon \Di \Di ();
423435 $ di ->set ('config ' , new Config ([
436+ 'acl ' => [
437+ 'attributes ' => $ attributes ,
438+ ],
424439 'permissions ' => [],
425440 'router ' => [
426441 'notFound ' => [
0 commit comments