[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:
Daniele Alessandri
2020-08-29 00:20:04 +02:00
parent c6f2ce4b83
commit 6d6c970ae2
16 changed files with 760 additions and 693 deletions
@@ -57,25 +57,15 @@ class ProtocolProcessorTest extends PredisTestCase
$connection = $this->getMockConnectionOfType('Predis\Connection\CompositeConnectionInterface');
$connection
->expects($this->at(0))
->expects($this->exactly(5))
->method('readLine')
->willReturn('+OK');
$connection
->expects($this->at(1))
->method('readLine')
->willReturn('-ERR error message');
$connection
->expects($this->at(2))
->method('readLine')
->willReturn(':2');
$connection
->expects($this->at(3))
->method('readLine')
->willReturn('$-1');
$connection
->expects($this->at(4))
->method('readLine')
->willReturn('*-1');
->willReturnOnConsecutiveCalls(
'+OK',
'-ERR error message',
':2',
'$-1',
'*-1'
);
$this->assertEquals('OK', $protocol->read($connection));
$this->assertEquals('ERR error message', $protocol->read($connection));