/** * @dataProvider receiveDataProvider * * @param array $parameters * @param array $response * * @throws ServiceException * @throws UndefinedCallbackException */ public function testProcessDataInterface($parameters, $response) { $paymentStatus = \Mockery::mock('\\Hcapi\\Interfaces\\IShopImplementation'); $paymentStatus->shouldReceive('getResponse')->with($parameters)->once()->andReturn($response); $service = new \Hcapi\Services\PaymentStatus(); $this->assertNotNull($service->processData($paymentStatus, $parameters)); }
/** * @return array|null * @throws \Hcapi\Services\ServiceException * @throws \Hcapi\Services\UndefinedCallbackException */ function listenRouteInterfaceExample() { /** * Specific url required by Heureka */ $routeUrl = $_SERVER['REQUEST_URI']; /** * Data received from Heureka */ $receiveData = $_POST; if ($routeUrl === '/api/1/products/availability') { $service = new \Hcapi\Services\ProductsAvailability(); $productsAvailability = new \Example\InterfaceExample\ProductsAvailability(); return $service->processData($productsAvailability, $receiveData); } if ($routeUrl === '/api/1/payment/delivery') { $service = new \Hcapi\Services\PaymentDelivery(); $paymentDelivery = new \Example\InterfaceExample\PaymentDelivery(); return $service->processData($paymentDelivery, $receiveData); } if ($routeUrl === '/api/1/order/status') { $service = new \Hcapi\Services\OrderStatus(); $orderStatus = new \Example\InterfaceExample\OrderStatus(); return $service->processData($orderStatus, $receiveData); } if ($routeUrl === '/api/1/order/send') { $service = new \Hcapi\Services\OrderSend(); $orderSend = new \Example\InterfaceExample\OrderSend(); return $service->processData($orderSend, $receiveData); } if ($routeUrl === '/api/1/order/cancel') { $service = new \Hcapi\Services\OrderCancel(); $orderCancel = new \Example\InterfaceExample\OrderCancel(); return $service->processData($orderCancel, $receiveData); } if ($routeUrl === '/api/1/payment/status') { $service = new \Hcapi\Services\PaymentStatus(); $paymentStatus = new \Example\InterfaceExample\PaymentStatus(); return $service->processData($paymentStatus, $receiveData); } return null; }