Skip to content

Commit

Permalink
Fixes a regression introduced in 1.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mnapoli committed Jun 19, 2014
1 parent 6013a80 commit 8844ae9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ACL.php
Expand Up @@ -164,7 +164,7 @@ public function rebuildAuthorizations()
$roleRepository = $this->entityManager->getRepository('MyCLabs\ACL\Model\Role');

// Clear
$this->entityManager->createQuery('DELETE MyCLabs\ACL\Model\Authorization');
$this->entityManager->createQuery('DELETE MyCLabs\ACL\Model\Authorization')->execute();
$this->entityManager->clear('MyCLabs\ACL\Model\Authorization');

// Regenerate
Expand Down
9 changes: 9 additions & 0 deletions tests/Integration/RebuildAuthorizationsTest.php
Expand Up @@ -27,11 +27,20 @@ public function testRebuildAuthorizations()

$this->em->clear();

$qb = $this->em->createQueryBuilder();
$qb->select('count(authorization.id)');
$qb->from('MyCLabs\ACL\Model\Authorization', 'authorization');
$query = $qb->getQuery();

$initialCount = $query->getSingleScalarResult();

$this->acl->rebuildAuthorizations();

$this->assertFalse($this->acl->isAllowed($user, Actions::VIEW, $article1));
$this->assertFalse($this->acl->isAllowed($user, Actions::EDIT, $article1));
$this->assertTrue($this->acl->isAllowed($user, Actions::VIEW, $article2));
$this->assertTrue($this->acl->isAllowed($user, Actions::EDIT, $article2));

$this->assertEquals($initialCount, $query->getSingleScalarResult());
}
}

0 comments on commit 8844ae9

Please sign in to comment.