* * 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:----jXx2CDgi+s6R4kldIdFGfLdQwAr5zJKYV9UXkSdW3b6JV/qZ+4OiXW7trh/wl9QNc0P/1g9M2H83q+NqGSCT8/vW3NXvyIlz9AsYQ0/HZZcSvrKiZZXefuvhuhp4D4JME3AqNNeieLx3UFpg2SAjFzDXxmZ30T4ZNDFTAv2oNVN+pHH+K5PhxM++tmpYoDKs1B1HYHTps8zA3agpfazSp5WtaDd3z+xZI9vd/gclpcuVUH+jE2dj20ckwokmW68ikCBfDvJxiblOhnkHucjJl7y62ZDRRvlkEFX0pNUmrW7Nehx8sFK37KEXzdaSG/ATXgZ6bORbVb7MgNugQF0RQtKylblJG9I4+QGe0SnBqbTruUH1wG9bTVJuXnNC772GqsiACx6VkFn1Ur3C0C7eN2bmlrfRG5JSUu4NScTjoHzdTiRN8nK2ariXUfaSH3qJju/NfvB3g17FxB7bu3p0lGxW2E6YFgfzzy7C8x4FYZICQgve39qpVWPgW3C6Xqh4tD9dycXrmPT5CAoX+p1hLTO4dsl82Nyr7D/Tq6pZUIMq0B8AFqgwsQIvzje+MMH0IFoXgPm2mOd7yLs9VRDnnj9esPnUGYBDrB/eKd8aqWIRqaisB9a6C71fTfJzjA+CWGmjPKzdlDMPMOMVKgMHzSsll2ZG9RwIOz1zRl3rY9w=----ATTACHMENT:----NTk0MDUyODM2MjI0NzIwMyA4NjcwOTk3NDk4MDM3OTAzIDExNjMzMzY1NDc3MjkwNDc=