mirror of
https://github.com/predis/predis.git
synced 2026-10-09 21:38:07 +00:00
[tests] Replace deprecated TestCase::at().
The "at" matcher will be removed in PHPUnit 10 but it is not a bad thing after all because it was cumbersome and error-prone. Took the opportunity to improve some tests while converting them.
This commit is contained in:
@@ -46,15 +46,16 @@ class ReplicationTest extends PredisTestCase
|
||||
/** @var OptionsInterface|MockObject */
|
||||
$options = $this->getMockBuilder('Predis\Configuration\OptionsInterface')->getMock();
|
||||
$options
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('__get')
|
||||
->with('autodiscovery')
|
||||
->willReturn(true);
|
||||
$options
|
||||
->expects($this->at(1))
|
||||
->method('__get')
|
||||
->with('connections')
|
||||
->willReturn($connectionFactory);
|
||||
->withConsecutive(
|
||||
array('autodiscovery'),
|
||||
array('connections')
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
true,
|
||||
$connectionFactory
|
||||
);
|
||||
|
||||
$this->assertInstanceOf('Closure', $initializer = $option->getDefault($options));
|
||||
$this->assertInstanceOf('Predis\Connection\Replication\MasterSlaveReplication', $connection = $initializer($options));
|
||||
@@ -142,17 +143,16 @@ class ReplicationTest extends PredisTestCase
|
||||
/** @var OptionsInterface|MockObject */
|
||||
$options = $this->getMockBuilder('Predis\Configuration\OptionsInterface')->getMock();
|
||||
$options
|
||||
->expects($this->at(0))
|
||||
->expects($this->exactly(2))
|
||||
->method('__get')
|
||||
->with('service')
|
||||
->willReturn('mymaster');
|
||||
$options
|
||||
->expects($this->at(1))
|
||||
->method('__get')
|
||||
->with('connections')
|
||||
->will($this->returnValue(
|
||||
->withConsecutive(
|
||||
array('service'),
|
||||
array('connections')
|
||||
)
|
||||
->willReturnOnConsecutiveCalls(
|
||||
'mymaster',
|
||||
$this->getMockBuilder('Predis\Connection\FactoryInterface')->getMock()
|
||||
));
|
||||
);
|
||||
|
||||
$parameters = array(
|
||||
$this->getMockBuilder('Predis\Connection\NodeConnectionInterface')->getMock(),
|
||||
|
||||
Reference in New Issue
Block a user