File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -164,7 +164,7 @@ public function rebuildAuthorizations()
164164 $ roleRepository = $ this ->entityManager ->getRepository ('MyCLabs\ACL\Model\Role ' );
165165
166166 // Clear
167- $ this ->entityManager ->createQuery ('DELETE MyCLabs\ACL\Model\Authorization ' );
167+ $ this ->entityManager ->createQuery ('DELETE MyCLabs\ACL\Model\Authorization ' )-> execute () ;
168168 $ this ->entityManager ->clear ('MyCLabs\ACL\Model\Authorization ' );
169169
170170 // Regenerate
Original file line number Diff line number Diff line change @@ -27,11 +27,20 @@ public function testRebuildAuthorizations()
2727
2828 $ this ->em ->clear ();
2929
30+ $ qb = $ this ->em ->createQueryBuilder ();
31+ $ qb ->select ('count(authorization.id) ' );
32+ $ qb ->from ('MyCLabs\ACL\Model\Authorization ' , 'authorization ' );
33+ $ query = $ qb ->getQuery ();
34+
35+ $ initialCount = $ query ->getSingleScalarResult ();
36+
3037 $ this ->acl ->rebuildAuthorizations ();
3138
3239 $ this ->assertFalse ($ this ->acl ->isAllowed ($ user , Actions::VIEW , $ article1 ));
3340 $ this ->assertFalse ($ this ->acl ->isAllowed ($ user , Actions::EDIT , $ article1 ));
3441 $ this ->assertTrue ($ this ->acl ->isAllowed ($ user , Actions::VIEW , $ article2 ));
3542 $ this ->assertTrue ($ this ->acl ->isAllowed ($ user , Actions::EDIT , $ article2 ));
43+
44+ $ this ->assertEquals ($ initialCount , $ query ->getSingleScalarResult ());
3645 }
3746}
You can’t perform that action at this time.
0 commit comments