1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- /*
- * This file is part of the Sonata Project package.
- *
- * (c) Thomas Rabaix <thomas.rabaix@sonata-project.org>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
- namespace Sonata\AdminBundle\Tests\Security\Handler;
- use Sonata\AdminBundle\Admin\AdminInterface;
- use Sonata\AdminBundle\Security\Handler\NoopSecurityHandler;
- class NoopSecurityHandlerTest extends \PHPUnit_Framework_TestCase
- {
- /**
- * @var NoopSecurityHandler
- */
- private $handler = null;
- public function setUp()
- {
- $this->handler = new NoopSecurityHandler();
- }
- public function testIsGranted()
- {
- $this->assertTrue($this->handler->isGranted($this->getSonataAdminObject(), array('TOTO')));
- $this->assertTrue($this->handler->isGranted($this->getSonataAdminObject(), 'TOTO'));
- }
- public function testBuildSecurityInformation()
- {
- $this->assertSame(array(), $this->handler->buildSecurityInformation($this->getSonataAdminObject()));
- }
- public function testCreateObjectSecurity()
- {
- $this->assertNull($this->handler->createObjectSecurity($this->getSonataAdminObject(), new \stdClass()));
- }
- public function testDeleteObjectSecurity()
- {
- $this->assertNull($this->handler->deleteObjectSecurity($this->getSonataAdminObject(), new \stdClass()));
- }
- public function testGetBaseRole()
- {
- $this->assertSame('', $this->handler->getBaseRole($this->getSonataAdminObject()));
- }
- /**
- * @return AdminInterface
- */
- private function getSonataAdminObject()
- {
- return $this->getMock('Sonata\AdminBundle\Admin\AdminInterface');
- }
- }
|