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 namespace Illuminate\Tests\Integration\Cache; use Illuminate\Foundation\Testing\Co..

Decoded Output download

<?php

namespace Illuminate\Tests\Integration\Cache;

use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
use Illuminate\Support\Facades\Cache;
use Illuminate\Tests\Integration\Cache\Fixtures\Unserializable;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

class Psr6RedisTest extends TestCase
{
    use InteractsWithRedis;

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

        $this->setUpRedis();
    }

    protected function tearDown(): void
    {
        parent::tearDown();

        $this->tearDownRedis();
    }

    #[DataProvider('redisClientDataProvider')]
    public function testTransactionIsNotOpenedWhenSerializationFails($redisClient): void
    {
        $this->app['config']['cache.default'] = 'redis';
        $this->app['config']['database.redis.client'] = $redisClient;

        $cache = $this->app->make('cache.psr6');

        $item = $cache->getItem('foo');

        $item->set(new Unserializable());
        $item->expiresAfter(60);

        $cache->save($item);

        Cache::store('redis')->get('foo');
    }

    /**
     * @return array
     */
    public static function redisClientDataProvider(): array
    {
        return [
            ['predis'],
            ['phpredis'],
        ];
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php

namespace Illuminate\Tests\Integration\Cache;

use Illuminate\Foundation\Testing\Concerns\InteractsWithRedis;
use Illuminate\Support\Facades\Cache;
use Illuminate\Tests\Integration\Cache\Fixtures\Unserializable;
use Orchestra\Testbench\TestCase;
use PHPUnit\Framework\Attributes\DataProvider;

class Psr6RedisTest extends TestCase
{
    use InteractsWithRedis;

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

        $this->setUpRedis();
    }

    protected function tearDown(): void
    {
        parent::tearDown();

        $this->tearDownRedis();
    }

    #[DataProvider('redisClientDataProvider')]
    public function testTransactionIsNotOpenedWhenSerializationFails($redisClient): void
    {
        $this->app['config']['cache.default'] = 'redis';
        $this->app['config']['database.redis.client'] = $redisClient;

        $cache = $this->app->make('cache.psr6');

        $item = $cache->getItem('foo');

        $item->set(new Unserializable());
        $item->expiresAfter(60);

        $cache->save($item);

        Cache::store('redis')->get('foo');
    }

    /**
     * @return array
     */
    public static function redisClientDataProvider(): array
    {
        return [
            ['predis'],
            ['phpredis'],
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 62b4072e4e3cb4cf696cee6037feef63
Eval Count 0
Decode Time 93 ms