mirror of
https://github.com/predis/predis.git
synced 2026-09-15 04:47:01 +00:00
Added missing test coverage
This commit is contained in:
@@ -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']]],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user