protected function getExtensions()
 {
     $this->roleBuilder = $roleBuilder = $this->getMockBuilder('Sonata\\UserBundle\\Security\\EditableRolesBuilder')->disableOriginalConstructor()->getMock();
     $this->roleBuilder->expects($this->any())->method('getRoles')->will($this->returnValue(array(0 => array('ROLE_FOO' => 'ROLE_FOO', 'ROLE_USER' => 'ROLE_USER', 'ROLE_ADMIN' => 'ROLE_ADMIN: ROLE_USER'), 1 => array())));
     $childType = new SecurityRolesType($this->roleBuilder);
     return array(new PreloadedExtension(array($childType->getName() => $childType), array()));
 }
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     parent::setDefaultOptions($resolver);
     $rolesExcluder = array_combine($this->_excludeRoles, array_fill(1, count($this->_excludeRoles), true));
     $resolver->setDefaults(array('choices' => function (Options $options, $parentChoices) use($rolesExcluder) {
         return array_diff_key($parentChoices, $rolesExcluder);
     }));
 }
 public function testGetParent()
 {
     $type = new SecurityRolesType($this->roleBuilder);
     $this->assertEquals(method_exists('Symfony\\Component\\Form\\FormTypeInterface', 'setDefaultOptions') ? 'choice' : 'Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType', $type->getParent());
 }
 public function testGetParent()
 {
     $type = new SecurityRolesType($this->roleBuilder);
     $this->assertEquals('choice', $type->getParent());
 }
 public function testGetParent()
 {
     $type = new SecurityRolesType($this->roleBuilder);
     $this->assertEquals('Symfony\\Component\\Form\\Extension\\Core\\Type\\ChoiceType', $type->getParent());
 }