コード例 #1
0
ファイル: AnalyticsBuilderTest.php プロジェクト: heoffice/crm
 /**
  * @param array $builders
  *
  * @dataProvider buildDataProvider
  */
 public function testBuild(array $builders)
 {
     /** @var Channel|\PHPUnit_Framework_MockObject_MockObject $entity */
     $entity = $this->getMock('OroCRM\\Bundle\\ChannelBundle\\Entity\\Channel');
     foreach ($builders as $builder) {
         $this->builder->addBuilder($builder);
     }
     $this->builder->build($entity);
 }
コード例 #2
0
ファイル: AnalyticsBuilderTest.php プロジェクト: antrampa/crm
 /**
  * @param array $builders
  * @param bool $expected
  *
  * @dataProvider buildDataProvider
  */
 public function testBuild(array $builders, $expected)
 {
     /** @var \PHPUnit_Framework_MockObject_MockObject|AnalyticsAwareInterface $entity */
     $entity = $this->getMock('OroCRM\\Bundle\\AnalyticsBundle\\Model\\AnalyticsAwareInterface');
     foreach ($builders as $builder) {
         $this->builder->addBuilder($builder);
     }
     $this->assertEquals($expected, $this->builder->build($entity));
 }
コード例 #3
0
 /**
  * @dataProvider dataAnalytics
  * @param string $ref
  * @param array $expectedIndex
  */
 public function testAnalyticsMetrics($ref, array $expectedIndex)
 {
     $doctrineHelper = $this->getContainer()->get('oro_entity.doctrine_helper');
     /** @var Customer $customer */
     $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);
     $rfmBuilder = new RFMBuilder($doctrineHelper);
     $rfmBuilder->addProvider($recencyProvider);
     $rfmBuilder->addProvider($frequencyProvider);
     $rfmBuilder->addProvider($monetaryProvider);
     $analitycs = new AnalyticsBuilder();
     $analitycs->addBuilder($rfmBuilder);
     $analitycs->build($customer);
     $this->assertEquals($expectedIndex['recency'], $customer->getRecency());
     $this->assertEquals($expectedIndex['frequency'], $customer->getFrequency());
     $this->assertEquals($expectedIndex['monetary'], $customer->getMonetary());
 }