$compilerPass =
new AddSecurityVotersPass();
$compilerPass->
process($container);
$def1 =
$container->
getDefinition('.debug.security.voter.voter1'
);
$this->
assertNull($def1->
getDecoratedService(), 'voter1: should not be decorated'
);
$this->
assertEquals(new Reference('voter1'
),
$def1->
getArgument(0
), 'voter1: wrong argument'
);
$def2 =
$container->
getDefinition('.debug.security.voter.voter2'
);
$this->
assertNull($def2->
getDecoratedService(), 'voter2: should not be decorated'
);
$this->
assertEquals(new Reference('voter2'
),
$def2->
getArgument(0
), 'voter2: wrong argument'
);
$voters =
$container->
findTaggedServiceIds('security.voter'
);
$this->
assertCount(2,
$voters, 'Incorrect count of voters'
);
} public function testThatVotersAreNotTraceableWithoutDebugMode() { $container =
new ContainerBuilder();
$container->
setParameter('kernel.debug', false
);
$voterDef1 =
new Definition(Voter::
class);
$voterDef1->
addTag('security.voter'
);
$container->
setDefinition('voter1',
$voterDef1);