Files
predis/tests/Predis/Transaction/Strategy/ReplicationConnectionStrategyTest.php
T
Vladyslav Vildanov 73e6a03fd8 Added support for transactions in OSS Cluster (#1497)
* Added support for transactions in OSS Cluster

* Updated test cases

* Updated version restriction

* Updated server version restriction

* Added test skip for Relay

* Added test case for Relay

* Set transaction slot to null in case of failed transaction

* Restrict usage of transaction commands outside of transaction context

* Added handling for Relay responses

* Reverted changes

* Removed unsupported command

* Added dummy arguments

* Codestyle fixes

* Added additional test coverage

* Added CHANGELOG and README entries

* Added missing PR reference

* Missing word

* Fixed README
2025-03-07 10:31:02 +02:00

54 lines
1.3 KiB
PHP

<?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\Transaction\Strategy;
use PHPUnit\Framework\TestCase;
use Predis\Command\CommandInterface;
use Predis\Connection\Replication\ReplicationInterface;
use Predis\Transaction\MultiExecState;
class ReplicationConnectionStrategyTest extends TestCase
{
/**
* @var ReplicationInterface
*/
private $mockConnection;
/**
* @var CommandInterface
*/
private $mockCommand;
protected function setUp(): void
{
$this->mockConnection = $this->getMockBuilder(ReplicationInterface::class)->getMock();
$this->mockCommand = $this->getMockBuilder(CommandInterface::class)->getMock();
}
/**
* @return void
*/
public function testExecuteCommand(): void
{
$this->mockConnection
->expects($this->once())
->method('executeCommand')
->with($this->mockCommand)
->willReturn('OK');
$strategy = new ReplicationConnectionStrategy($this->mockConnection, new MultiExecState());
$this->assertEquals('OK', $strategy->executeCommand($this->mockCommand));
}
}