コード例 #1
0
ファイル: AclTest.php プロジェクト: jaztec/jaztec-acl
 /**
  * @covers \JaztecAcl\Acl\Acl::createResource
  */
 public function testCreateResource()
 {
     // Set up ACL
     $this->acl->allow();
     $em = Bootstrap::getServiceManager()->get('doctrine.entitymanager.orm_default');
     /* @var $em \Doctrine\ORM\EntityManager */
     $this->acl->createResource('resource2', 'base', $em);
     $resource = $em->getRepository('JaztecAcl\\Entity\\Acl\\Resource')->findOneBy(array('name' => 'resource2'));
     /* @var $resource \JaztecAcl\Entity\Acl\Resource */
     // Test if the resource exists.
     $this->assertTrue($resource instanceof \JaztecAcl\Entity\Acl\Resource, "A new resource should've been added");
     $this->assertTrue($this->acl->hasResource($resource), "The local ACL should contain the newly added resource");
 }