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 Phalcon Framework. * * (c) Phalcon Team <team@pha..

Decoded Output download

<?php

/**
 * This file is part of the Phalcon Framework.
 *
 * (c) Phalcon Team <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE.txt
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Phalcon\Tests\Unit\Http\Response;

use DateTime;
use DateTimeZone;
use Phalcon\Tests\Unit\Http\Helper\HttpBase;
use UnitTester;

class SetCacheCest extends HttpBase
{
    /**
     * Tests setCache
     *
     * @author Sid Roberts <https://github.com/SidRoberts>
     * @since  2015-07-14
     */
    public function testHttpResponseSetCache(UnitTester $I)
    {
        $response = $this->getResponseObject();

        $expiry = new DateTime();

        $expiry->setTimezone(
            new DateTimeZone('UTC')
        );

        $expiry->modify('+60 minutes');

        $response->setCache(60);

        $actual = $response->getHeaders();
        $I->assertSame(
            $expiry->format('D, d M Y H:i:s') . ' GMT',
            $actual->get('Expires')
        );
        $I->assertSame(
            'max-age=3600',
            $actual->get('Cache-Control')
        );
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

/**
 * This file is part of the Phalcon Framework.
 *
 * (c) Phalcon Team <[email protected]>
 *
 * For the full copyright and license information, please view the LICENSE.txt
 * file that was distributed with this source code.
 */

declare(strict_types=1);

namespace Phalcon\Tests\Unit\Http\Response;

use DateTime;
use DateTimeZone;
use Phalcon\Tests\Unit\Http\Helper\HttpBase;
use UnitTester;

class SetCacheCest extends HttpBase
{
    /**
     * Tests setCache
     *
     * @author Sid Roberts <https://github.com/SidRoberts>
     * @since  2015-07-14
     */
    public function testHttpResponseSetCache(UnitTester $I)
    {
        $response = $this->getResponseObject();

        $expiry = new DateTime();

        $expiry->setTimezone(
            new DateTimeZone('UTC')
        );

        $expiry->modify('+60 minutes');

        $response->setCache(60);

        $actual = $response->getHeaders();
        $I->assertSame(
            $expiry->format('D, d M Y H:i:s') . ' GMT',
            $actual->get('Expires')
        );
        $I->assertSame(
            'max-age=3600',
            $actual->get('Cache-Control')
        );
    }
}

Function Calls

None

Variables

None

Stats

MD5 9e57fc53d6014811ef0fdf1512853076
Eval Count 0
Decode Time 103 ms