Added missing test coverage

This commit is contained in:
vladvildanov
2023-07-31 17:06:04 +03:00
parent 2146d2012f
commit 480b05a214
2 changed files with 59 additions and 0 deletions
@@ -0,0 +1,27 @@
<?php
/*
* This file is part of the Predis package.
*
* (c) 2009-2020 Daniele Alessandri
* (c) 2021-2023 Till Krüss
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Predis\Command\Container;
use Predis\ClientInterface;
use PredisTestCase;
class TFUNCTION_Test extends PredisTestCase
{
public function testGetId(): void
{
$mockClient = $this->getMockBuilder(ClientInterface::class)->getMock();
$container = new TFUNCTION($mockClient);
$this->assertSame('TFUNCTION', $container->getContainerCommandId());
}
}
@@ -75,6 +75,22 @@ class TFUNCTION_Test extends PredisCommandTestCase
$this->assertSameValues($expected, $command->getArguments());
}
/**
* @group disconnected
* @dataProvider responseProvider
* @param array $arguments
* @param array $actualData
* @param array $expectedData
* @return void
*/
public function testParseResponse(array $arguments, array $actualData, array $expectedData): void
{
$command = $this->getCommand();
$command->setArguments($arguments);
$this->assertEquals($expectedData, $command->parseResponse($actualData));
}
/**
* @group connected
* @group gears
@@ -157,4 +173,20 @@ class TFUNCTION_Test extends PredisCommandTestCase
],
];
}
public function responseProvider(): array
{
return [
'with non-LIST subcommand' => [
['LOAD', 'lib'],
[['key', 'value']],
[['key', 'value']],
],
'with LIST subcommand' => [
['LIST'],
[['key', 'value', ['key1', 'value1']]],
[['key' => 'value', 2 => ['key1' => 'value1']]],
],
];
}
}