* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Security\Core\Tests\Authorization; use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authorization\AccessDecisionManager; use Symfony\Component\Security\Core\Authorization\DebugAccessDecisionManager; use Symfony\Component\Security\Core\Authorization\TraceableAccessDecisionManager; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; class TraceableAccessDecisionManagerTest extends TestCase { /** * @dataProvider provideObjectsAndLogs */ public function testDecideLog($expectedLog, $object) { $adm = new TraceableAccessDecisionManager(new AccessDecisionManager()); $adm->decide($this->getMockBuilder(TokenInterface::class)->getMock(), array('ATTRIBUTE_1'), $object); $this->assertSame($expectedLog, $adm->getDecisionLog()); } public function provideObjectsAndLogs() { $object = new \stdClass(); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => null, 'result' => false)), null); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => true, 'result' => false)), true); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 'jolie string', 'result' => false)), 'jolie string'); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => 12345, 'result' => false)), 12345); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = fopen(__FILE__, 'r'), 'result' => false)), $x); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $x = array(), 'result' => false)), $x); yield array(array(array('attributes' => array('ATTRIBUTE_1'), 'object' => $object, 'result' => false)), $object); } public function testDebugAccessDecisionManagerAliasExistsForBC() { $adm = new TraceableAccessDecisionManager(new AccessDecisionManager()); $this->assertInstanceOf(DebugAccessDecisionManager::class, $adm, 'For BC, TraceableAccessDecisionManager must be an instance of DebugAccessDecisionManager'); } } __halt_compiler();----SIGNATURE:----gUmJviofJtaKJ9ShyemPHJ2exkf1yu6aRasVVv/gYv5cgYU6w2Sdu1iphU6vdqpUzizBK8BW4f/2SLaVOu0U346uUMbx1mQ4HtfzaQV3rd1vta1z+XC+QHxcyF4CxTAW8QugoQjfDjlYLcZfEHMS4cgBGWOItuLXVa8rhi+K28oynramDsVEvJeWVR+HwO5AtBG0SGk9lRk9Ck8LS3DDfgQwqCQHXAoO1AXG57TbTSuI+n+i1kzjkT2vRZ3YLfDyqSwnj2d9aA/tiLqoqGDEI7k9GnrjAO2rdBba4WOv/FoA2xXob8p+lMrBrhKEtPtDa+QbBkB/zuOKgrP+h0bR7iK2buSJOOELBrWt7npf26E1YDJG8Z5i8A2brYOuoH3Et0MtmBxqWPhVi2YEgwAIAxnA7YCZ6kd++Zx//NvK3JGeALuBFUrVNozjB+JPjFja/v3Dbs0w2TBxjX2Q54SBgJ9mpFgYd9fG0cm2Vhz1f50AkB9MBZrEDR9yFkKJPnLDyeBJUHcI3Diosjbyo+YivhxxXCyjCu9AdRshY8GJcFxjjta46nrh1MX8n/6VKZwXzmQMUon739FShC0f4pr72Y4zDoght+JZ74nLKEicFZffixKfejBYpXPjj6DwSPWZU1HOQPNu1CgAe3NVawOiUWsYmTtoMjVj0e2/aB+UQHA=----ATTACHMENT:----NDg4NDY2MDk0ODcxOTgwMSA5NjYzMjAyMTU2NDUyMDIxIDU2MDI5ODE1NDMzNDIzNTE=