/**
  * @param array $inputData
  * @param array $expectedData
  * @dataProvider buildBeforeFrontendQuotesProvider
  */
 public function testBuildBeforeFrontendItems(array $inputData, array $expectedData)
 {
     $this->securityProvider->expects($this->any())->method('isGrantedViewLocal')->with($this->entityClass)->willReturn($inputData['grantedViewLocal']);
     $this->securityProvider->expects($this->any())->method('isGrantedViewAccountUser')->with($this->entityClass)->willReturn($inputData['grantedViewAccountUser']);
     $this->securityProvider->expects($this->any())->method('getLoggedUser')->willReturn($inputData['user']);
     $datagridConfig = DatagridConfiguration::create($inputData['config']);
     $event = new BuildBefore($this->datagrid, $datagridConfig);
     $this->listener->onBuildBeforeFrontendItems($event);
     $this->assertEquals($expectedData['config'], $datagridConfig->toArray());
 }
 /**
  * @param array $inputData
  * @param int $expectedResult
  *
  * @dataProvider voteProvider
  */
 public function testVote(array $inputData, $expectedResult)
 {
     $object = $inputData['object'];
     $class = is_object($object) ? get_class($object) : null;
     $this->doctrineHelper->expects($this->any())->method('getEntityClass')->with($object)->willReturn($class);
     $this->doctrineHelper->expects($this->any())->method('getSingleEntityIdentifier')->with($object, false)->willReturn($inputData['objectId']);
     $this->securityFacade->expects($this->any())->method('isGranted')->with($inputData['isGrantedAttr'], $inputData['isGrantedDescr'])->willReturn($inputData['isGranted']);
     $this->securityProvider->expects($this->any())->method('isGrantedViewBasic')->with($class)->willReturn($inputData['grantedViewBasic']);
     $this->securityProvider->expects($this->any())->method('isGrantedViewLocal')->with($class)->willReturn($inputData['grantedViewLocal']);
     $this->securityProvider->expects($this->any())->method('isGrantedEditBasic')->with($class)->willReturn($inputData['grantedEditBasic']);
     $this->securityProvider->expects($this->any())->method('isGrantedEditLocal')->with($class)->willReturn($inputData['grantedEditLocal']);
     $this->voter->setClassName($class);
     /* @var $token TokenInterface|\PHPUnit_Framework_MockObject_MockObject */
     $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $token->expects($this->any())->method('getUser')->willReturn($inputData['user']);
     $this->assertEquals($expectedResult, $this->voter->vote($token, $object, $inputData['attributes']));
 }
 /**
  * @param string $object
  * @return bool
  */
 public function isGrantedViewAccountUser($object)
 {
     return $this->securityProvider->isGrantedViewAccountUser($object);
 }
 public function testIsGrantedViewAccountUser()
 {
     $object = new \stdClass();
     $this->securityProvider->expects($this->once())->method('isGrantedViewAccountUser')->with($object)->willReturn(true);
     $this->assertTrue($this->extension->isGrantedViewAccountUser($object));
 }
 /**
  * @return boolean
  */
 protected function permissionShowAccountUserColumn()
 {
     return $this->securityProvider->isGrantedViewAccountUser($this->entityClass);
 }