[tests] Start improving test suite.

- Make use of more typehints for function parameters
- Make use of typehints for function return values
- Use @var where needed to give proper hints to IDEs and avoid warnings
- Replace MockObject::setMethods() with addMethods() and onlyMethods()
- Rewording of some phpdocs
This commit is contained in:
Daniele Alessandri
2020-08-28 18:59:10 +02:00
parent c2ede30394
commit 36c9bb047e
236 changed files with 2887 additions and 2454 deletions
@@ -12,6 +12,7 @@
namespace Predis\Protocol\Text;
use PredisTestCase;
use Predis\Protocol\Text\Handler\ResponseHandlerInterface;
/**
*
@@ -21,7 +22,7 @@ class ResponseReaderTest extends PredisTestCase
/**
* @group disconnected
*/
public function testDefaultHandlers()
public function testDefaultHandlers(): void
{
$reader = new ResponseReader();
@@ -37,8 +38,9 @@ class ResponseReaderTest extends PredisTestCase
/**
* @group disconnected
*/
public function testReplaceHandler()
public function testReplaceHandler(): void
{
/** @var ResponseHandlerInterface */
$handler = $this->getMockBuilder('Predis\Protocol\Text\Handler\ResponseHandlerInterface')->getMock();
$reader = new ResponseReader();
@@ -50,7 +52,7 @@ class ResponseReaderTest extends PredisTestCase
/**
* @group disconnected
*/
public function testReadResponse()
public function testReadResponse(): void
{
$connection = $this->getMockConnectionOfType('Predis\Connection\CompositeConnectionInterface');
$connection
@@ -86,7 +88,7 @@ class ResponseReaderTest extends PredisTestCase
/**
* @group disconnected
*/
public function testEmptyResponseHeader()
public function testEmptyResponseHeader(): void
{
$this->expectException('Predis\Protocol\ProtocolException');
$this->expectExceptionMessage('Unexpected empty reponse header [tcp://127.0.0.1:6379]');
@@ -104,7 +106,7 @@ class ResponseReaderTest extends PredisTestCase
/**
* @group disconnected
*/
public function testUnknownResponsePrefix()
public function testUnknownResponsePrefix(): void
{
$this->expectException('Predis\Protocol\ProtocolException');
$this->expectExceptionMessage("Unknown response prefix: '!' [tcp://127.0.0.1:6379]");