/** * @dataProvider getCampaignsDataProvider * * @param string|null $status * @param bool|null $usesSegment * @param array $expectedFilters */ public function testGetCampaigns($status, $usesSegment, array $expectedFilters) { $staticSegmentRepository = $this->getMockBuilder('OroCRM\\Bundle\\MailChimpBundle\\Entity\\Repository\\StaticSegmentRepository')->disableOriginalConstructor()->getMock(); $this->managerRegistry->expects($this->once())->method('getRepository')->will($this->returnValue($staticSegmentRepository)); $staticSegmentRepository->expects($this->once())->method('getStaticSegments')->will($this->returnValue([$this->getStaticSegmentMock()])); $channel = $this->getMockBuilder('Oro\\Bundle\\IntegrationBundle\\Entity\\Channel')->disableOriginalConstructor()->getMock(); $this->initTransport(); $result = $this->transport->getCampaigns($channel, $status, $usesSegment); $this->assertInstanceOf('OroCRM\\Bundle\\MailChimpBundle\\Provider\\Transport\\Iterator\\CampaignIterator', $result); $this->assertAttributeSame($expectedFilters, 'filters', $result); }