/** * @test */ public function itShouldCreateASofortOrder() { $order = Order::create(1234, 'EUR', 'sofort', [], 'Sofort Transfer order description', 'my-order-id', 'http://www.example.com', 'PT10M'); $this->httpClient->shouldReceive('post')->once()->with('orders/', m::on(function (array $options) use($order) { $this->assertEquals('application/json', $options['headers']['Content-Type']); $this->assertEquals(ArrayFunctions::withoutNullValues($order->toArray()), json_decode($options['body'], true)); return true; }))->andReturn($this->httpResponse); $this->httpResponse->shouldReceive('json')->once()->andReturn(ArrayFunctions::withoutNullValues($order->toArray())); $this->assertInstanceOf('GingerPayments\\Payment\\Order', $this->client->createSofortOrder(1234, 'EUR', [], 'Sofort Transfer order description', 'my-order-id', 'http://www.example.com', 'PT10M')); }