コード例 #1
0
 /**
  * @dataProvider attributesDataProvider
  * @param array $attributes
  * @param $marketingList
  * @param $expected
  */
 public function testVote($attributes, $marketingList, $expected)
 {
     $object = $this->getMockBuilder('Oro\\Bundle\\SegmentBundle\\Entity\\Segment')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper->expects($this->once())->method('getEntityClass')->with($object)->will($this->returnValue(MarketingListSegmentVoter::SEGMENT_ENTITY));
     $this->doctrineHelper->expects($this->once())->method('getSingleEntityIdentifier')->with($object, false)->will($this->returnValue(1));
     if ($this->voter->supportsAttribute($attributes[0])) {
         $this->assertMarketingListLoad($marketingList);
     }
     $token = $this->getMock('Symfony\\Component\\Security\\Core\\Authentication\\Token\\TokenInterface');
     $this->assertEquals($expected, $this->voter->vote($token, $object, $attributes));
 }