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\Traits;

use Averias\RedisJson\Enum\JsonCommands;
use Averias\RedisJson\Enum\Keys;
use Averias\RedisJson\Tests\Unit\Command\BaseTestJsonCommandTrait;

class JsonObjectKeysCommandTest extends BaseTestJsonCommandTrait
{
    /**
     * @dataProvider getJsonObjectKeysDataProvider
     * @param array $returnedValue
     * @param string $key
     * @param string $path
     */
    public function testJsonObjectKeys(?array $returnedValue, string $key, string $path): void
    {
        $mock = $this->getRedisJsonClient($returnedValue, [JsonCommands::OBJECT_KEYS, [$key], [$key, $path]]);
        $result = $mock->jsonObjectKeys($key, $path);
        $this->assertEquals($returnedValue, $result);
    }

    public function getJsonObjectKeysDataProvider(): array
    {
        return [
            [['key1', 'key2'], Keys::DEFAULT_KEY, '.'],
            [null, Keys::DEFAULT_KEY, '.path']
        ];
    }
}
 ?>

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\Traits;

use Averias\RedisJson\Enum\JsonCommands;
use Averias\RedisJson\Enum\Keys;
use Averias\RedisJson\Tests\Unit\Command\BaseTestJsonCommandTrait;

class JsonObjectKeysCommandTest extends BaseTestJsonCommandTrait
{
    /**
     * @dataProvider getJsonObjectKeysDataProvider
     * @param array $returnedValue
     * @param string $key
     * @param string $path
     */
    public function testJsonObjectKeys(?array $returnedValue, string $key, string $path): void
    {
        $mock = $this->getRedisJsonClient($returnedValue, [JsonCommands::OBJECT_KEYS, [$key], [$key, $path]]);
        $result = $mock->jsonObjectKeys($key, $path);
        $this->assertEquals($returnedValue, $result);
    }

    public function getJsonObjectKeysDataProvider(): array
    {
        return [
            [['key1', 'key2'], Keys::DEFAULT_KEY, '.'],
            [null, Keys::DEFAULT_KEY, '.path']
        ];
    }
}

Function Calls

None

Variables

None

Stats

MD5 0bc674224cd00bdc0e6742f1ce898deb
Eval Count 0
Decode Time 127 ms