/**
  * @param int|null $priceListId
  * @param array $priceCurrencies
  * @param array $sourceResults
  * @param ProductPrice[] $prices
  * @param array $expectedResults
  * @dataProvider onResultAfterDataProvider
  */
 public function testOnResultAfter($priceListId = null, array $priceCurrencies = [], array $sourceResults = [], array $prices = [], array $expectedResults = [])
 {
     $priceRepository = $this->getMockBuilder('OroB2B\\Bundle\\PricingBundle\\Entity\\Repository\\ProductPriceRepository')->disableOriginalConstructor()->getMock();
     $this->doctrineHelper->expects($this->any())->method('getEntityRepository')->with('OroB2BPricingBundle:ProductPrice')->willReturn($priceRepository);
     $sourceResultRecords = [];
     $productIds = [];
     foreach ($sourceResults as $sourceResult) {
         $sourceResultRecords[] = new ResultRecord($sourceResult);
         $productIds[] = $sourceResult['id'];
     }
     if ($priceListId && $priceCurrencies) {
         $this->priceListRequestHandler->expects($this->any())->method('getPriceList')->willReturn($this->getPriceList($priceListId));
         $this->priceListRequestHandler->expects($this->any())->method('getPriceListSelectedCurrencies')->will($this->returnCallback(function () use($priceCurrencies) {
             return array_intersect(['USD', 'EUR'], $priceCurrencies);
         }));
         $this->priceListRequestHandler->expects($this->any())->method('getShowTierPrices')->willReturn(true);
         $priceRepository->expects($this->any())->method('findByPriceListIdAndProductIds')->with($priceListId, $productIds)->willReturn($prices);
     }
     /** @var \PHPUnit_Framework_MockObject_MockObject|DatagridInterface $datagrid */
     $datagrid = $this->getMock('Oro\\Bundle\\DataGridBundle\\Datagrid\\DatagridInterface');
     $event = new OrmResultAfter($datagrid, $sourceResultRecords);
     $this->listener->onResultAfter($event);
     $actualResults = $event->getRecords();
     $this->assertSameSize($expectedResults, $actualResults);
     foreach ($expectedResults as $key => $expectedResult) {
         $actualResult = $actualResults[$key];
         foreach ($expectedResult as $name => $value) {
             $this->assertEquals($value, $actualResult->getValue($name));
         }
     }
 }
 /**
  * @return array
  */
 protected function getCurrencies()
 {
     return $this->priceListRequestHandler->getPriceListSelectedCurrencies();
 }