Esempio n. 1
0
 protected function setUp()
 {
     $this->stepExecutionMock = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->setMethods(['getExecutionContext'])->disableOriginalConstructor()->getMock();
     $this->transportSettings = $this->getMockForAbstractClass('Oro\\Bundle\\IntegrationBundle\\Entity\\Transport');
     $this->transportMock = $this->getMock('Oro\\Bundle\\IntegrationBundle\\Provider\\TransportInterface');
     $this->transportMock->expects($this->any())->method('getTest');
 }
 /**
  * @ TransportInterface $transport
  */
 public function initFromContext()
 {
     $this->transport = $this->contextMediator->getTransport($this->getContext(), true);
     $this->channel = $this->contextMediator->getChannel($this->getContext());
     if (!$this->transport) {
         throw new \InvalidArgumentException('Transport was not provided');
     }
     $this->transport->init($this->channel->getTransport());
 }
Esempio n. 3
0
 /**
  * {@inheritdoc}
  */
 protected function initializeFromContext(ContextInterface $context)
 {
     $this->transport = $this->contextMediator->getTransport($context, true);
     $this->channel = $this->contextMediator->getChannel($context);
     $this->validateConfiguration();
     $this->transport->init($this->channel->getTransport());
     $this->setSourceIterator($this->getConnectorSource());
     if ($this->getSourceIterator() instanceof LoggerAwareInterface) {
         $this->getSourceIterator()->setLogger($this->logger);
     }
 }
 protected function setUp()
 {
     $this->stepExecutionMock = $this->getMockBuilder('Akeneo\\Bundle\\BatchBundle\\Entity\\StepExecution')->setMethods(['getExecutionContext', 'getJobExecution'])->disableOriginalConstructor()->getMock();
     $jobExecution = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Entity\\JobExecution');
     $jobInstance = $this->getMock('Akeneo\\Bundle\\BatchBundle\\Entity\\JobInstance');
     $jobExecution->expects($this->any())->method('getJobInstance')->will($this->returnValue($jobInstance));
     $this->stepExecutionMock->expects($this->any())->method('getJobExecution')->will($this->returnValue($jobExecution));
     $jobInstance->expects($this->any())->method('getAlias')->will($this->returnValue('alias'));
     $this->transportSettings = $this->getMockForAbstractClass('Oro\\Bundle\\IntegrationBundle\\Entity\\Transport');
     $this->transportMock = $this->getMock('Oro\\Bundle\\IntegrationBundle\\Provider\\TransportInterface');
     $this->transportMock->expects($this->any())->method('getTest');
 }
 /**
  * @param StaticSegment $value
  * @param UniqueStaticSegmentNameConstraint|Constraint $constraint
  */
 public function validate($value, Constraint $constraint)
 {
     if ($value instanceof StaticSegment && !$value->getOriginId()) {
         $this->transport->init($value->getChannel()->getTransport());
         $segments = $this->transport->getListStaticSegments($value->getSubscribersList());
         foreach ($segments as $segment) {
             if ($segment['name'] == $value->getName()) {
                 $this->context->addViolationAt('name', $constraint->message);
                 break;
             }
         }
     }
 }
 /**
  * {@inheritdoc}
  */
 public function setDefaultOptions(OptionsResolverInterface $resolver)
 {
     $resolver->setDefaults(['data_class' => $this->transport->getSettingsEntityFQCN()]);
 }
Esempio n. 7
0
 /**
  * Transport setting entity should be set to form
  * in case when password should be merged from saved data
  *
  * @param Request $request
  * @param TransportInterface $transport
  * @return MagentoSoapTransport
  */
 protected function getTransportEntity(Request $request, $transport)
 {
     $data = null;
     $id = $request->get('id', false);
     if ($id) {
         $data = $this->get('doctrine.orm.entity_manager')->find($transport->getSettingsEntityFQCN(), $id);
     }
     $form = $this->get('form.factory')->createNamed('soap-check', $transport->getSettingsFormType(), $data, ['csrf_protection' => false]);
     $form->submit($request);
     return $form->getData();
 }