Procházet zdrojové kódy

Show the difference between security properties (#4256)

The test for securityInformation had inaccurate data, and there was no
documentation for the accessMapping. This change helps getting what the
difference between both properties is.
Grégoire Paris před 8 roky
rodič
revize
958ffdffbe
2 změnil soubory, kde provedl 5 přidání a 2 odebrání
  1. 1 1
      Admin/AbstractAdmin.php
  2. 4 1
      Tests/Admin/AdminTest.php

+ 1 - 1
Admin/AbstractAdmin.php

@@ -443,7 +443,7 @@ abstract class AbstractAdmin implements AdminInterface, DomainObjectInterface
     /**
      * The Access mapping.
      *
-     * @var array
+     * @var array [action1 => requiredRole1, action2 => [requiredRole2, requiredRole3]]
      */
     protected $accessMapping = array();
 

+ 4 - 1
Tests/Admin/AdminTest.php

@@ -797,7 +797,10 @@ class AdminTest extends \PHPUnit_Framework_TestCase
 
         $this->assertSame(array(), $admin->getSecurityInformation());
 
-        $securityInformation = array('ROLE_FOO', 'ROLE_BAR');
+        $securityInformation = array(
+            'GUEST' => array('VIEW', 'LIST'),
+            'STAFF' => array('EDIT', 'LIST', 'CREATE'),
+        );
 
         $admin->setSecurityInformation($securityInformation);
         $this->assertSame($securityInformation, $admin->getSecurityInformation());