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 declare(strict_types=1); /** * CakePHP : Rapid Development Framework (https://cake..

Decoded Output download

<?php
declare(strict_types=1);

/**
 * CakePHP : Rapid Development Framework (https://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 * @link          https://cakephp.org CakePHP Project
 * @since         4.0.5
 * @license       https://opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Test\TestCase\TestSuite;

use Cake\TestSuite\TestCase;
use Cake\TestSuite\TestSession;

class TestSessionTest extends TestCase
{
    /**
     * @var array
     */
    protected $sessionData;

    /**
     * @var \Cake\TestSuite\TestSession
     */
    protected $session;

    public function setUp(): void
    {
        parent::setUp();

        $this->sessionData = [
            'root' => [
                'sub' => [
                    'subsub' => 'foo',
                ],
            ],
        ];
        $this->session = new TestSession($this->sessionData);
    }

    /**
     * Tests read()
     */
    public function testRead(): void
    {
        $result = $this->session->read();
        $this->assertSame($this->sessionData, $result);

        $result = $this->session->read('root.sub');
        $this->assertSame(['subsub' => 'foo'], $result);
    }

    /**
     * Tests check()
     */
    public function testCheck(): void
    {
        $result = $this->session->check();
        $this->assertTrue($result);

        $result = $this->session->check('root.sub');
        $this->assertTrue($result);

        $result = $this->session->check('root.nonexistent');
        $this->assertFalse($result);
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
declare(strict_types=1);

/**
 * CakePHP : Rapid Development Framework (https://cakephp.org)
 * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 *
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
 * @link          https://cakephp.org CakePHP Project
 * @since         4.0.5
 * @license       https://opensource.org/licenses/mit-license.php MIT License
 */
namespace Cake\Test\TestCase\TestSuite;

use Cake\TestSuite\TestCase;
use Cake\TestSuite\TestSession;

class TestSessionTest extends TestCase
{
    /**
     * @var array
     */
    protected $sessionData;

    /**
     * @var \Cake\TestSuite\TestSession
     */
    protected $session;

    public function setUp(): void
    {
        parent::setUp();

        $this->sessionData = [
            'root' => [
                'sub' => [
                    'subsub' => 'foo',
                ],
            ],
        ];
        $this->session = new TestSession($this->sessionData);
    }

    /**
     * Tests read()
     */
    public function testRead(): void
    {
        $result = $this->session->read();
        $this->assertSame($this->sessionData, $result);

        $result = $this->session->read('root.sub');
        $this->assertSame(['subsub' => 'foo'], $result);
    }

    /**
     * Tests check()
     */
    public function testCheck(): void
    {
        $result = $this->session->check();
        $this->assertTrue($result);

        $result = $this->session->check('root.sub');
        $this->assertTrue($result);

        $result = $this->session->check('root.nonexistent');
        $this->assertFalse($result);
    }
}

Function Calls

None

Variables

None

Stats

MD5 f476303459169e26b5d2f02c4b8c0b5e
Eval Count 0
Decode Time 85 ms