public function testProcess()
 {
     $connectors = ['testConnector_initial'];
     $syncStartDate = new \DateTime('now', new \DateTimeZone('UTC'));
     $realConnector = new InitialConnector();
     $integration = $this->getIntegration($connectors, $syncStartDate, $realConnector);
     $transport = new MagentoSoapTransport();
     $transport->setNewsletterSubscriberSyncedToId(42);
     $integration->expects($this->any())->method('getTransport')->will($this->returnValue($transport));
     $this->assertProcessCalls();
     $this->assertExecuteJob(['initialSyncInterval' => '7 days', 'processorAlias' => false, 'entityName' => 'testEntity', 'channel' => 'testChannel', 'channelType' => 'testChannelType', 'initial_id' => 42]);
     $this->processor->process($integration);
 }
 public function testProcess()
 {
     $connectors = ['testConnector_initial'];
     $syncStartDate = new \DateTime('now', new \DateTimeZone('UTC'));
     $realConnector = new InitialConnector();
     $integration = $this->getIntegration($connectors, $syncStartDate, $realConnector);
     $status = $this->getMockBuilder('Oro\\Bundle\\IntegrationBundle\\Entity\\Status')->disableOriginalConstructor()->getMock();
     $this->repository->expects($this->atLeastOnce())->method('getLastStatusForConnector')->with($integration, InitialNewsletterSubscriberConnector::TYPE)->will($this->returnValue($status));
     $this->assertProcessCalls();
     $this->assertExecuteJob(['processorAlias' => false, 'entityName' => 'testEntity', 'channel' => 'testChannel', 'channelType' => 'testChannelType', 'initial_id' => 54321]);
     $qb = $this->getMockBuilder('Doctrine\\ORM\\QueryBuilder')->disableOriginalConstructor()->getMock();
     $qb->expects($this->once())->method('select')->will($this->returnSelf());
     $qb->expects($this->once())->method('where')->will($this->returnSelf());
     $qb->expects($this->once())->method('expr')->will($this->returnValue(new Expr()));
     $query = $this->getMockBuilder('Doctrine\\ORM\\AbstractQuery')->setMethods(['getSingleScalarResult'])->disableOriginalConstructor()->getMockForAbstractClass();
     $query->expects($this->once())->method('getSingleScalarResult')->willReturn(54321);
     $qb->expects($this->once())->method('getQuery')->will($this->returnValue($query));
     $this->repository->expects($this->once())->method('createQueryBuilder')->willReturn($qb);
     $this->processor->process($integration);
 }