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); /** * This file is part of CodeIgniter 4 framework. * ..
Decoded Output download
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\StreamFilterTrait;
use PHPUnit\Framework\Attributes\Group;
/**
* @internal
*/
#[Group('Others')]
final class ClearDebugbarTest extends CIUnitTestCase
{
use StreamFilterTrait;
private int $time;
protected function setUp(): void
{
parent::setUp();
$this->time = time();
}
protected function createDummyDebugbarJson(): void
{
$time = $this->time;
$path = WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$time}.json";
// create 10 dummy debugbar json files
for ($i = 0; $i < 10; $i++) {
$path = str_replace((string) $time, (string) ($time - $i), $path);
file_put_contents($path, "{}
");
$time -= $i;
}
}
public function testClearDebugbarWorks(): void
{
// test clean debugbar dir
$this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json");
// test dir is now populated with json
$this->createDummyDebugbarJson();
$this->assertFileExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json");
command('debugbar:clear');
$result = $this->getStreamFilterBuffer();
$this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json");
$this->assertFileExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . 'index.html');
$this->assertStringContainsString('Debugbar cleared.', $result);
}
}
?>
Did this file decode correctly?
Original Code
<?php
declare(strict_types=1);
/**
* This file is part of CodeIgniter 4 framework.
*
* (c) CodeIgniter Foundation <[email protected]>
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace CodeIgniter\Commands;
use CodeIgniter\Test\CIUnitTestCase;
use CodeIgniter\Test\StreamFilterTrait;
use PHPUnit\Framework\Attributes\Group;
/**
* @internal
*/
#[Group('Others')]
final class ClearDebugbarTest extends CIUnitTestCase
{
use StreamFilterTrait;
private int $time;
protected function setUp(): void
{
parent::setUp();
$this->time = time();
}
protected function createDummyDebugbarJson(): void
{
$time = $this->time;
$path = WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$time}.json";
// create 10 dummy debugbar json files
for ($i = 0; $i < 10; $i++) {
$path = str_replace((string) $time, (string) ($time - $i), $path);
file_put_contents($path, "{}\n");
$time -= $i;
}
}
public function testClearDebugbarWorks(): void
{
// test clean debugbar dir
$this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json");
// test dir is now populated with json
$this->createDummyDebugbarJson();
$this->assertFileExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json");
command('debugbar:clear');
$result = $this->getStreamFilterBuffer();
$this->assertFileDoesNotExist(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . "debugbar_{$this->time}.json");
$this->assertFileExists(WRITEPATH . 'debugbar' . DIRECTORY_SEPARATOR . 'index.html');
$this->assertStringContainsString('Debugbar cleared.', $result);
}
}
Function Calls
None |
Stats
MD5 | 5d42f34e5dc06dca0a1d6491590d460c |
Eval Count | 0 |
Decode Time | 102 ms |