Пример #1
0
 /**
  * @dataProvider dataValue
  * @param string $ref
  * @param array $expectedValue
  */
 public function testAnalyticsProviderValues($ref, array $expectedValue)
 {
     $doctrineHelper = $this->getContainer()->get('oro_entity.doctrine_helper');
     $customer = $this->getReference($ref);
     $className = 'OroCRM\\Bundle\\MagentoBundle\\Entity\\Customer';
     $recencyProvider = new CustomerRecencyProvider($doctrineHelper, $className);
     $frequencyProvider = new CustomerFrequencyProvider($doctrineHelper, $className);
     $monetaryProvider = new CustomerMonetaryProvider($doctrineHelper, $className);
     $this->assertEquals($expectedValue['recency'], $recencyProvider->getValue($customer));
     $this->assertEquals($expectedValue['frequency'], $frequencyProvider->getValue($customer));
     $this->assertEquals($expectedValue['monetary'], $monetaryProvider->getValue($customer));
 }
Пример #2
0
 /**
  * @dataProvider dataValue
  * @param string $dataChannelRef
  * @param array $expectedValue
  */
 public function testAnalyticsProviderValues($dataChannelRef, array $expectedValue)
 {
     $doctrineHelper = $this->getContainer()->get('oro_entity.doctrine_helper');
     /** @var Channel $dataChannel */
     $dataChannel = $this->getReference($dataChannelRef);
     $className = 'OroCRM\\Bundle\\MagentoBundle\\Entity\\Customer';
     $recencyProvider = new CustomerRecencyProvider($doctrineHelper, $className);
     $frequencyProvider = new CustomerFrequencyProvider($doctrineHelper, $className);
     $monetaryProvider = new CustomerMonetaryProvider($doctrineHelper, $className);
     $recencyData = $recencyProvider->getValues($dataChannel);
     $this->assertCount(1, $recencyData);
     $frequencyData = $frequencyProvider->getValues($dataChannel);
     $this->assertCount(1, $frequencyData);
     $monetaryData = $monetaryProvider->getValues($dataChannel);
     $this->assertCount(1, $monetaryData);
     foreach ($expectedValue as $customerReference => $data) {
         /** @var Customer $customer */
         $customer = $this->getReference($customerReference);
         $this->assertEquals($data['recency'], $recencyData[$customer->getId()]);
         $this->assertEquals($data['frequency'], $frequencyData[$customer->getId()]);
         $this->assertEquals($data['monetary'], $monetaryData[$customer->getId()]);
     }
 }