NoopSecurityHandlerTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /*
  3. * This file is part of the Sonata package.
  4. *
  5. * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Sonata\AdminBundle\Tests\Admin\Security\Acl\Permission;
  11. use Sonata\AdminBundle\Security\Handler\NoopSecurityHandler;
  12. class NoopSecurityHandlerTest extends \PHPUnit_Framework_TestCase
  13. {
  14. /**
  15. * @var Sonata\AdminBundle\Security\Handler\NoopSecurityHandler
  16. */
  17. private $handler = null;
  18. public function setUp()
  19. {
  20. $this->handler = new NoopSecurityHandler();
  21. }
  22. public function testIsGranted()
  23. {
  24. $this->assertTrue($this->handler->isGranted($this->getSonataAdminObject(), array('TOTO')));
  25. $this->assertTrue($this->handler->isGranted($this->getSonataAdminObject(), 'TOTO'));
  26. }
  27. public function testBuildSecurityInformation()
  28. {
  29. $this->assertEquals(array(), $this->handler->buildSecurityInformation($this->getSonataAdminObject()));
  30. }
  31. /**
  32. * @return Sonata\AdminBundle\Admin\AdminInterface
  33. */
  34. private function getSonataAdminObject()
  35. {
  36. return $this->getMock('Sonata\AdminBundle\Admin\AdminInterface');
  37. }
  38. }