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 PhpRedisJSON library * * @project phpredis-json * @..

Decoded Output download

<?php
/**
 * This file is part of PhpRedisJSON library
 *
 * @project   phpredis-json
 * @author    Rafael Campoy <[email protected]>
 * @copyright 2019 Rafael Campoy <[email protected]>
 * @license   MIT
 * @link      https://github.com/averias/phpredis-json
 *
 * Copyright and license information, is included in
 * the LICENSE file that is distributed with this source code.
 */

namespace Averias\RedisJson\Tests\Unit\Command;

use Averias\RedisJson\Client\RedisJsonClient;
use Averias\RedisJson\Client\RedisJsonClientInterface;
use Averias\RedisJson\Adapter\RedisClientAdapter;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class BaseTestJsonCommandTrait extends TestCase
{
    public function getRedisJsonClient($returnValue, array $arguments): RedisJsonClientInterface
    {
        return new RedisJsonClient($this->getRedisClientAdapterMock($returnValue, $arguments));
    }

    public function getRedisClientAdapterMock($returnValue, array $arguments): MockObject
    {
        $mock = $this->getMockBuilder(RedisClientAdapter::class)->disableOriginalConstructor()->getMock();
        $mock->expects($this->any())
            ->method('executeJsonCommand')
            ->with(...$arguments)
            ->willReturn($returnValue);

        return $mock;
    }
}
 ?>

Did this file decode correctly?

Original Code

<?php
/**
 * This file is part of PhpRedisJSON library
 *
 * @project   phpredis-json
 * @author    Rafael Campoy <[email protected]>
 * @copyright 2019 Rafael Campoy <[email protected]>
 * @license   MIT
 * @link      https://github.com/averias/phpredis-json
 *
 * Copyright and license information, is included in
 * the LICENSE file that is distributed with this source code.
 */

namespace Averias\RedisJson\Tests\Unit\Command;

use Averias\RedisJson\Client\RedisJsonClient;
use Averias\RedisJson\Client\RedisJsonClientInterface;
use Averias\RedisJson\Adapter\RedisClientAdapter;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

class BaseTestJsonCommandTrait extends TestCase
{
    public function getRedisJsonClient($returnValue, array $arguments): RedisJsonClientInterface
    {
        return new RedisJsonClient($this->getRedisClientAdapterMock($returnValue, $arguments));
    }

    public function getRedisClientAdapterMock($returnValue, array $arguments): MockObject
    {
        $mock = $this->getMockBuilder(RedisClientAdapter::class)->disableOriginalConstructor()->getMock();
        $mock->expects($this->any())
            ->method('executeJsonCommand')
            ->with(...$arguments)
            ->willReturn($returnValue);

        return $mock;
    }
}

Function Calls

None

Variables

None

Stats

MD5 003a768d5667df1169ff9acd9d168dfd
Eval Count 0
Decode Time 90 ms