Exemplo n.º 1
0
 /**
  * @return void
  */
 protected function setUp()
 {
     parent::setUp();
     $countryFacadeMock = $this->getMockBuilder(SalesToCountryInterface::class)->setMethods(['getIdCountryByIso2Code', 'getAvailableCountries'])->getMock();
     $countryFacadeMock->method('getIdCountryByIso2Code')->will($this->returnValue(1));
     $omsOrderProcessEntity = $this->getProcessEntity();
     $omsFacadeMock = $this->getMockBuilder(SalesToOmsInterface::class)->setMethods(['selectProcess', 'getInitialStateEntity', 'getProcessEntity', 'getManualEvents', 'getItemsWithFlag', 'getManualEventsByIdSalesOrder', 'getDistinctManualEventsByIdSalesOrder', 'getOrderItemMatrix'])->getMock();
     $omsFacadeMock->method('selectProcess')->will($this->returnValue('CheckoutTest01'));
     $initialStateEntity = SpyOmsOrderItemStateQuery::create()->filterByName(OmsConstants::INITIAL_STATUS)->findOneOrCreate();
     $initialStateEntity->save();
     $omsFacadeMock->method('getInitialStateEntity')->will($this->returnValue($initialStateEntity));
     $omsFacadeMock->method('getProcessEntity')->will($this->returnValue($omsOrderProcessEntity));
     $sequenceNumberFacade = new SequenceNumberFacade();
     $container = new Container();
     $container[SalesDependencyProvider::FACADE_COUNTRY] = new SalesToCountryBridge($countryFacadeMock);
     $container[SalesDependencyProvider::FACADE_OMS] = new SalesToOmsBridge($omsFacadeMock);
     $container[SalesDependencyProvider::FACADE_SEQUENCE_NUMBER] = new SalesToSequenceNumberBridge($sequenceNumberFacade);
     $this->salesFacade = new SalesFacade();
     $businessFactory = new SalesBusinessFactory();
     $salesConfigMock = $this->getMockBuilder(SalesConfig::class)->setMethods(['determineProcessForOrderItem'])->getMock();
     $salesConfigMock->method('determineProcessForOrderItem')->willReturn('');
     $businessFactory->setConfig($salesConfigMock);
     $businessFactory->setContainer($container);
     $this->salesFacade->setFactory($businessFactory);
 }
Exemplo n.º 2
0
 /**
  * @return \Spryker\Zed\Sales\Communication\Plugin\SalesOrderSaverPlugin
  */
 protected function createOrderSaverPlugin()
 {
     $salesOrderSaverPlugin = new SalesOrderSaverPlugin();
     $salesConfigMock = $this->getMockBuilder(SalesConfig::class)->setMethods(['determineProcessForOrderItem'])->getMock();
     $salesConfigMock->method('determineProcessForOrderItem')->willReturn('Nopayment01');
     $salesBusinessFactoryMock = $this->getMockBuilder(SalesBusinessFactory::class)->setMethods(['getConfig'])->getMock();
     $salesBusinessFactoryMock->method('getConfig')->willReturn($salesConfigMock);
     $container = new Container();
     $container[SalesDependencyProvider::FACADE_COUNTRY] = function (Container $container) {
         return new SalesToCountryBridge($container->getLocator()->country()->facade());
     };
     $container[SalesDependencyProvider::FACADE_OMS] = function (Container $container) {
         return new SalesToOmsBridge($container->getLocator()->oms()->facade());
     };
     $container[SalesDependencyProvider::FACADE_SEQUENCE_NUMBER] = function (Container $container) {
         return new SalesToSequenceNumberBridge($container->getLocator()->sequenceNumber()->facade());
     };
     $salesBusinessFactoryMock->setContainer($container);
     $salesFacade = new SalesFacade();
     $salesFacade->setFactory($salesBusinessFactoryMock);
     $salesOrderSaverPlugin->setFacade($salesFacade);
     return $salesOrderSaverPlugin;
 }