[SecurityBundle] Rename FirewallContext#getContext()
This commit is contained in:
parent
3165e134de
commit
ee66b4973d
@ -12,3 +12,9 @@ Security
|
|||||||
|
|
||||||
* The `RoleInterface` has been deprecated. Extend the `Symfony\Component\Security\Core\Role\Role`
|
* The `RoleInterface` has been deprecated. Extend the `Symfony\Component\Security\Core\Role\Role`
|
||||||
class in your custom role implementations instead.
|
class in your custom role implementations instead.
|
||||||
|
|
||||||
|
SecurityBundle
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* The `FirewallContext::getContext()` method has been deprecated and will be removed in 4.0.
|
||||||
|
Use the `getListeners()` method instead.
|
||||||
|
@ -134,6 +134,11 @@ FrameworkBundle
|
|||||||
`serializer.mapping.cache.apc` and `serializer.mapping.cache.doctrine.apc`
|
`serializer.mapping.cache.apc` and `serializer.mapping.cache.doctrine.apc`
|
||||||
have been removed. APCu should now be automatically used when available.
|
have been removed. APCu should now be automatically used when available.
|
||||||
|
|
||||||
|
SecurityBundle
|
||||||
|
--------------
|
||||||
|
|
||||||
|
* The `FirewallContext::getContext()` method has been removed, use the `getListeners()` method instead.
|
||||||
|
|
||||||
HttpFoundation
|
HttpFoundation
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
@ -37,7 +37,17 @@ class FirewallContext
|
|||||||
return $this->config;
|
return $this->config;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated since version 3.3, will be removed in 4.0. Use {@link getListeners()} instead.
|
||||||
|
*/
|
||||||
public function getContext()
|
public function getContext()
|
||||||
|
{
|
||||||
|
@trigger_error(sprintf('Method %s() is deprecated since version 3.3 and will be removed in 4.0. Use %s::getListeners() instead.', __METHOD__, __CLASS__), E_USER_DEPRECATED);
|
||||||
|
|
||||||
|
return $this->getListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getListeners()
|
||||||
{
|
{
|
||||||
return array($this->listeners, $this->exceptionListener);
|
return array($this->listeners, $this->exceptionListener);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class FirewallMap implements FirewallMapInterface
|
|||||||
return array(array(), null);
|
return array(array(), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $context->getContext();
|
return $context->getListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,12 +21,7 @@ class FirewallContextTest extends \PHPUnit_Framework_TestCase
|
|||||||
public function testGetters()
|
public function testGetters()
|
||||||
{
|
{
|
||||||
$config = new FirewallConfig('main', 'user_checker', 'request_matcher');
|
$config = new FirewallConfig('main', 'user_checker', 'request_matcher');
|
||||||
|
$exceptionListener = $this->getExceptionListenerMock();
|
||||||
$exceptionListener = $this
|
|
||||||
->getMockBuilder(ExceptionListener::class)
|
|
||||||
->disableOriginalConstructor()
|
|
||||||
->getMock();
|
|
||||||
|
|
||||||
$listeners = array(
|
$listeners = array(
|
||||||
$this
|
$this
|
||||||
->getMockBuilder(ListenerInterface::class)
|
->getMockBuilder(ListenerInterface::class)
|
||||||
@ -36,7 +31,25 @@ class FirewallContextTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
$context = new FirewallContext($listeners, $exceptionListener, $config);
|
$context = new FirewallContext($listeners, $exceptionListener, $config);
|
||||||
|
|
||||||
$this->assertEquals(array($listeners, $exceptionListener), $context->getContext());
|
$this->assertEquals(array($listeners, $exceptionListener), $context->getListeners());
|
||||||
$this->assertEquals($config, $context->getConfig());
|
$this->assertEquals($config, $context->getConfig());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedDeprecation Method Symfony\Bundle\SecurityBundle\Security\FirewallContext::getContext() is deprecated since version 3.3 and will be removed in 4.0. Use Symfony\Bundle\SecurityBundle\Security\FirewallContext::getListeners() instead.
|
||||||
|
* @group legacy
|
||||||
|
*/
|
||||||
|
public function testGetContextTriggersDeprecation()
|
||||||
|
{
|
||||||
|
(new FirewallContext(array(), $this->getExceptionListenerMock(), new FirewallConfig('main', 'request_matcher', 'user_checker')))
|
||||||
|
->getContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
private function getExceptionListenerMock()
|
||||||
|
{
|
||||||
|
return $this
|
||||||
|
->getMockBuilder(ExceptionListener::class)
|
||||||
|
->disableOriginalConstructor()
|
||||||
|
->getMock();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user