Commit 5a9516ed authored by Georald Camposano's avatar Georald Camposano Committed by Fabien Potencier

Added test for access rule path array

parent a8cc0ae4
...@@ -340,7 +340,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener ...@@ -340,7 +340,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
'host' => null, 'host' => null,
'methods' => null, 'methods' => null,
'ips' => null, 'ips' => null,
'attributes' => null, 'attributes' => array(),
'schemes' => null, 'schemes' => null,
]; ];
$rule[0] = new RequestMatcher($rule[0]['path'], $rule[0]['host'], $rule[0]['methods'], $rule[0]['ips'], $rule[0]['attributes'], $rule[0]['schemes']); $rule[0] = new RequestMatcher($rule[0]['path'], $rule[0]['host'], $rule[0]['methods'], $rule[0]['ips'], $rule[0]['attributes'], $rule[0]['schemes']);
......
...@@ -243,6 +243,31 @@ class SecurityServiceProviderTest extends WebTestCase ...@@ -243,6 +243,31 @@ class SecurityServiceProviderTest extends WebTestCase
$this->assertNull($app['user']); $this->assertNull($app['user']);
} }
public function testAccessRulePathArray()
{
$app = new Application();
$app->register(new SecurityServiceProvider(), array(
'security.firewalls' => array(
'default' => array(
'http' => true,
),
),
'security.access_rules' => array(
array(array(
'path' => '^/admin',
), 'ROLE_ADMIN'),
),
));
$request = Request::create('/admin');
$app->boot();
$accessMap = $app['security.access_map'];
$this->assertEquals($accessMap->getPatterns($request), array(
array('ROLE_ADMIN'),
'',
));
}
public function createApplication($authenticationMethod = 'form') public function createApplication($authenticationMethod = 'form')
{ {
$app = new Application(); $app = new Application();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment