Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save chillbits-legacy/b1a9af9390955247a2269f414ea90039 to your computer and use it in GitHub Desktop.
Save chillbits-legacy/b1a9af9390955247a2269f414ea90039 to your computer and use it in GitHub Desktop.
<?php
Class Test {
public function test_update_order_status_but_get_unexpected_response()
{
$response = '<html random tag from server>';
$this->mockingHttpClientWith($response);
$service = new WebsiteService();
$order = $this->getCompletedOrder();
try {
$service->updateOrderStatus($order->id);
$this->fail('Expected exception 5520201117 not thrown');
}catch(\Exception $exception) {
$this->assertEquals(5520201117, $exception->getCode());
$this->assertEquals('Unexpected response from server', $exception->getMessage());
}
}
}
@chillbits-legacy
Copy link
Author

root@1579294083a3:/var/www# phpunit --filter test_update_order_status_but_get_unexpected_response
PHPUnit 7.5.20 by Sebastian Bergmann and contributors.

.                                                                   1 / 1 (100%)

Time: 607 ms, Memory: 14.00 MB

OK (1 test, 4 assertions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment