/**
  * @@dataProvider aclTestData
  */
 public function testFindAclData($oids, $findAcl, $expect, $parameter)
 {
     list($oid, $rootOid, $underlyingOid) = $oids;
     $factory = $this->getMockBuilder('Oro\\Bundle\\SecurityBundle\\Acl\\Domain\\ObjectIdentityFactory')->disableOriginalConstructor()->getMock();
     $sids = array($this->getMock('Symfony\\Component\\Security\\Acl\\Model\\SecurityIdentityInterface'));
     $this->baseProvider->expects($this->any())->method('cacheEmptyAcl');
     $this->baseProvider->expects($this->any())->method('findAcl')->will($this->returnCallback(function ($oid, $sids) use($findAcl) {
         if (isset($findAcl[$this->getOidKey($oid)])) {
             return $findAcl[$this->getOidKey($oid)];
         }
         throw new AclNotFoundException('Acl not found');
     }));
     $factory->expects($this->any())->method('root')->with($this->equalTo($oid))->will($this->returnValue($rootOid));
     $factory->expects($this->any())->method('underlying')->with($this->equalTo($oid))->will($this->returnValue($underlyingOid));
     $provider = new RootBasedAclProvider($factory);
     $provider->setBaseAclProvider($this->baseProvider);
     if (empty($findAcl)) {
         $this->setExpectedException('Symfony\\Component\\Security\\Acl\\Exception\\AclNotFoundException');
     }
     $resultAcl = $provider->findAcl($oid, $sids);
     $this->{$expect}($resultAcl, $parameter);
 }
 public function testFindAclWithNoAclAndNoUnderlyingAndRoot()
 {
     $sids = array($this->getMock('Symfony\\Component\\Security\\Acl\\Model\\SecurityIdentityInterface'));
     $oid = new ObjectIdentity(123, 'Test');
     $rootOid = new ObjectIdentity('entity', ObjectIdentityFactory::ROOT_IDENTITY_TYPE);
     $rootAcl = $this->getAcl($rootOid);
     $this->baseProvider->expects($this->never())->method('isReplaceWithUnderlyingAcl');
     $this->baseProvider->expects($this->never())->method('isEmptyAcl');
     $this->baseProvider->expects($this->once())->method('cacheEmptyAcl')->with($oid);
     // todo: Acl cache must be refactoring due task https://magecore.atlassian.net/browse/BAP-3649
     //$this->baseProvider->expects($this->never())
     //    ->method('cacheWithUnderlyingAcl');
     $this->setFindAclExpectation([$this->getOidKey($rootOid) => $rootAcl]);
     $resultAcl = $this->provider->findAcl($oid, $sids);
     $this->assertEquals($rootAcl, $resultAcl);
 }