-
Notifications
You must be signed in to change notification settings - Fork 150
Expand file tree
/
Copy pathHttpClientTest.php
More file actions
42 lines (37 loc) · 1.07 KB
/
Copy pathHttpClientTest.php
File metadata and controls
42 lines (37 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* This file is part of the Cloudinary PHP package.
*
* (c) Cloudinary
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Cloudinary\Test\Unit;
use Cloudinary\Exception\Error;
use Cloudinary\HttpClient;
use Monolog\Logger as Monolog;
use ReflectionException;
/**
* Class HttpClientTest
*/
final class HttpClientTest extends UnitTestCase
{
/**
* @throws ReflectionException
*/
public function testLoggingParseInvalidJsonResponse()
{
$httpClient = new HttpClient();
$message = null;
$expectedLogMessage = 'Error parsing JSON server response';
$expectedExceptionMessage = 'Error parsing server response';
try {
$httpClient->getJson('https://cloudinary.com/');
} catch (Error $e) {
$message = $e->getMessage();
}
self::assertStringStartsWith($expectedExceptionMessage, $message);
self::assertObjectLoggedMessage($httpClient, $expectedLogMessage, Monolog::CRITICAL);
}
}