Example #1
0
 public static function createTestAclPermission()
 {
     $testData = self::$testData;
     $testData['resource'] = AclResourceTest::createTestAclResource();
     $testData['role'] = AclRoleTest::createTestAclRole();
     return new AclPermission($testData);
 }
Example #2
0
 public function testIsAdmin()
 {
     $role = AclRoleTest::createTestAclRole('Administrator');
     $user = self::createTestUser();
     $this->assertFalse($user->isAdmin());
     $user->setRole($role);
     $this->assertTrue($user->isAdmin());
 }
Example #3
0
 public function testUpdate()
 {
     $testEntity = AclRoleTest::createTestAclRole();
     self::$entityManager->persist($testEntity);
     self::$entityManager->flush();
     $this->assertNotEquals('fubar', $testEntity->getName());
     $testEntity->setName('fubar');
     AclRoleService::update();
     $entities = self::$entityManager->createQuery('SELECT e FROM Rexmac\\Zyndax\\Entity\\AclRole e')->execute();
     $this->assertEquals('fubar', $entities[0]->getName());
 }
Example #4
0
 private function setUp2()
 {
     $entityManager = UserService::getEntityManager();
     $testRole = AclRoleTest::createTestAclRole();
     $entityManager->persist($testRole);
     for ($i = 0; $i < 3; ++$i) {
         $testUser = UserTest::createRandomTestUser($testRole);
         $entityManager->persist($testUser);
     }
     for ($i = 0; $i < 2; ++$i) {
         $testUser = UserTest::createRandomTestUser($testRole);
         $testUser->setActive(false);
         $testUser->setLocked(true);
         $entityManager->persist($testUser);
     }
     $entityManager->flush();
 }