示例#1
0
 /**
  * @dataProvider receiveDataProvider
  *
  * @param array $parameters
  * @param array $response
  *
  * @throws ServiceException
  * @throws UndefinedCallbackException
  */
 public function testProcessDataInterface($parameters, $response)
 {
     $orderSend = \Mockery::mock('\\Hcapi\\Interfaces\\IShopImplementation');
     $orderSend->shouldReceive('getResponse')->with($parameters)->once()->andReturn($response);
     $service = new OrderSend();
     $this->assertNotNull($service->processData($orderSend, $parameters));
 }
示例#2
0
文件: Router.php 项目: heureka/hcapi
 /**
  * @return array|null
  * @throws \Hcapi\Services\ServiceException
  * @throws \Hcapi\Services\UndefinedCallbackException
  */
 function listenRouteCallbackExample()
 {
     /**
      * Specific url required by Heureka
      */
     $routeUrl = $_SERVER['REQUEST_URI'];
     /**
      * Data received from Heureka
      */
     $receiveData = $_POST;
     if ($routeUrl === '/api/1/products/availability') {
         $service = new ProductsAvailability();
         return $service->processData(['Example\\CallableExample\\ProductsAvailability', 'getActualData'], $receiveData);
     }
     if ($routeUrl === '/api/1/payment/delivery') {
         $service = new PaymentDelivery();
         return $service->processData(['Example\\CallableExample\\PaymentDelivery', 'getTransportsPayments'], $receiveData);
     }
     if ($routeUrl === '/api/1/order/status') {
         $service = new OrderStatus();
         return $service->processData(['Example\\CallableExample\\OrderStatus', 'checkStatus'], $receiveData);
     }
     if ($routeUrl === '/api/1/order/send') {
         $service = new OrderSend();
         return $service->processData(['Example\\CallableExample\\OrderSend', 'processOrder'], $receiveData);
     }
     if ($routeUrl === '/api/1/order/cancel') {
         $service = new OrderCancel();
         return $service->processData(['Example\\CallableExample\\OrderCancel', 'cancelOrder'], $receiveData);
     }
     if ($routeUrl === '/api/1/payment/status') {
         $service = new PaymentStatus();
         return $service->processData(['Example\\CallableExample\\PaymentStatus', 'setPaymentStatus'], $receiveData);
     }
     return null;
 }