示例#1
0
 /**
  * {@inheritdoc}
  */
 protected function initializeFromContext(ContextInterface $context)
 {
     $this->channel = $this->contextMediator->getChannel($context);
     $this->transport = $this->contextMediator->getInitializedTransport($this->channel, true);
     // info was loaded from index action
     if ($this->transport->isSupportedExtensionVersion()) {
         return;
     }
     $entitiesIds = (array) $this->stepExecution->getJobExecution()->getExecutionContext()->get($this->contextKey);
     if (!$entitiesIds) {
         return;
     }
     sort($entitiesIds);
     $this->ids = array_unique(array_filter($entitiesIds));
 }
 public function testGetInitializedTransport()
 {
     $testTransport = $this->getMock('Oro\\Bundle\\IntegrationBundle\\Provider\\TransportInterface');
     $transportEntity = $this->getMockForAbstractClass('Oro\\Bundle\\IntegrationBundle\\Entity\\Transport');
     $integration = new Integration();
     $integration->setTransport($transportEntity);
     $this->registry->expects($this->once())->method('getTransportTypeBySettingEntity')->will($this->returnValue($testTransport));
     $testTransport->expects($this->once())->method('init')->with($transportEntity);
     $result = $this->contextMediator->getInitializedTransport($integration);
     $this->assertEquals($testTransport, $result);
     // test local cache
     $this->contextMediator->getInitializedTransport($integration);
 }