Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php /** * This file is part of the Cloudinary PHP package. * * (c) Cloudinary * * F..

Decoded Output download

<?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('http://cloudinary.com/');
        } catch (Error $e) {
            $message = $e->getMessage();
        }

        self::assertStringStartsWith($expectedExceptionMessage, $message);
        self::assertObjectLoggedMessage($httpClient, $expectedLogMessage, Monolog::CRITICAL);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?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('http://cloudinary.com/');
        } catch (Error $e) {
            $message = $e->getMessage();
        }

        self::assertStringStartsWith($expectedExceptionMessage, $message);
        self::assertObjectLoggedMessage($httpClient, $expectedLogMessage, Monolog::CRITICAL);
    }
}

Function Calls

None

Variables

None

Stats

MD5 d906e4ad6c07d4b42993f40fb2970c35
Eval Count 0
Decode Time 83 ms