From 57f95321dc69ddf5ea644e5ddcf4f08217c9d979 Mon Sep 17 00:00:00 2001 From: Enrico Zimuel Date: Fri, 26 Jan 2024 11:41:56 +0100 Subject: [PATCH] Fixed the tests with property type declarations --- tests/ClientBuilderTest.php | 6 +++++- tests/ClientTest.php | 7 +++++++ tests/Integration/BasicTest.php | 3 +++ tests/Integration/BulkTest.php | 2 ++ tests/Integration/MlTest.php | 2 ++ tests/Response/ElasticsearchTest.php | 7 +++++++ tests/Transport/Adapter/GuzzleTest.php | 1 + tests/Transport/Adapter/SymfonyTest.php | 3 ++- tests/Transport/AsyncOnSuccessNoExceptionTest.php | 3 +++ tests/Transport/AsyncOnSuccessTest.php | 3 +++ 10 files changed, 35 insertions(+), 2 deletions(-) diff --git a/tests/ClientBuilderTest.php b/tests/ClientBuilderTest.php index bd32f0d7d..fb1bab26b 100644 --- a/tests/ClientBuilderTest.php +++ b/tests/ClientBuilderTest.php @@ -32,7 +32,11 @@ class ClientBuilderTest extends TestCase { protected ClientInterface $httpClient; protected LoggerInterface $logger; - + protected HttpAsyncClient $asyncHttpClient; + protected NodePoolInterface $nodePool; + protected Psr17Factory $psr17Factory; + protected ClientBuilder $builder; + public function setUp(): void { $this->httpClient = $this->createStub(ClientInterface::class); diff --git a/tests/ClientTest.php b/tests/ClientTest.php index 0878b8a9d..01443594e 100644 --- a/tests/ClientTest.php +++ b/tests/ClientTest.php @@ -20,6 +20,7 @@ use Elastic\Elasticsearch\Exception\ServerResponseException; use Elastic\Elasticsearch\Response\Elasticsearch; use Elastic\Transport\NodePool\NodePoolInterface; +use Elastic\Transport\Transport; use Elastic\Transport\TransportBuilder; use Http\Mock\Client as MockClient; use Http\Promise\Promise; @@ -29,6 +30,12 @@ class ClientTest extends TestCase { + protected LoggerInterface $logger; + protected MockClient $httpClient; + protected Transport $transport; + protected Psr17Factory $psr17Factory; + protected Client $client; + public function setUp(): void { $this->logger = $this->createStub(LoggerInterface::class); diff --git a/tests/Integration/BasicTest.php b/tests/Integration/BasicTest.php index df080dee0..0ddc0971a 100644 --- a/tests/Integration/BasicTest.php +++ b/tests/Integration/BasicTest.php @@ -14,6 +14,7 @@ namespace Elastic\Elasticsearch\Tests\Integration; +use Elastic\Elasticsearch\Client; use Elastic\Elasticsearch\Tests\Utility; use PHPUnit\Framework\TestCase; @@ -22,6 +23,8 @@ */ class BasicTest extends TestCase { + protected Client $client; + public function setUp(): void { $this->client = Utility::getClient(); diff --git a/tests/Integration/BulkTest.php b/tests/Integration/BulkTest.php index f33aaff2f..b7d535e8a 100644 --- a/tests/Integration/BulkTest.php +++ b/tests/Integration/BulkTest.php @@ -24,6 +24,8 @@ class BulkTest extends TestCase { const TEST_INDEX = 'test'; + protected Client $client; + public function setUp(): void { $this->client = Utility::getClient(); diff --git a/tests/Integration/MlTest.php b/tests/Integration/MlTest.php index d86d8d6bc..1caa25ddf 100644 --- a/tests/Integration/MlTest.php +++ b/tests/Integration/MlTest.php @@ -25,6 +25,8 @@ class MlTest extends TestCase { const JOB_ID = 'total-requests'; + protected Client $client; + public function setUp(): void { $this->client = Utility::getClient(); diff --git a/tests/Response/ElasticsearchTest.php b/tests/Response/ElasticsearchTest.php index 735755038..8e5f0fbee 100644 --- a/tests/Response/ElasticsearchTest.php +++ b/tests/Response/ElasticsearchTest.php @@ -21,9 +21,16 @@ use Elastic\Elasticsearch\Response\Elasticsearch; use Nyholm\Psr7\Factory\Psr17Factory; use PHPUnit\Framework\TestCase; +use Psr\Http\Message\ResponseInterface; class ElasticsearchTest extends TestCase { + protected Psr17Factory $psr17Factory; + protected ResponseInterface $elasticsearch; + protected ResponseInterface $response200; + protected ResponseInterface $response400; + protected ResponseInterface $response500; + public function setUp(): void { $this->psr17Factory = new Psr17Factory(); diff --git a/tests/Transport/Adapter/GuzzleTest.php b/tests/Transport/Adapter/GuzzleTest.php index ecd6e0aac..fec894d03 100644 --- a/tests/Transport/Adapter/GuzzleTest.php +++ b/tests/Transport/Adapter/GuzzleTest.php @@ -24,6 +24,7 @@ class GuzzleTest extends TestCase { protected Guzzle $guzzleAdapter; + protected ClientInterface $client; public function setUp(): void { diff --git a/tests/Transport/Adapter/SymfonyTest.php b/tests/Transport/Adapter/SymfonyTest.php index 3b62e63f9..686ea11dc 100644 --- a/tests/Transport/Adapter/SymfonyTest.php +++ b/tests/Transport/Adapter/SymfonyTest.php @@ -25,7 +25,8 @@ class SymfonyTest extends TestCase { protected Symfony $symfonyAdapter; - + protected ClientInterface $client; + public function setUp(): void { $this->symfonyAdapter = new Symfony; diff --git a/tests/Transport/AsyncOnSuccessNoExceptionTest.php b/tests/Transport/AsyncOnSuccessNoExceptionTest.php index 0fe67ca61..8ab66dadd 100644 --- a/tests/Transport/AsyncOnSuccessNoExceptionTest.php +++ b/tests/Transport/AsyncOnSuccessNoExceptionTest.php @@ -21,6 +21,9 @@ class AsyncOnSuccessNoExceptionTest extends TestCase { + protected Psr17Factory $psr17Factory; + protected AsyncOnSuccessNoException $asyncOnSuccess; + public function setUp(): void { $this->asyncOnSuccess = new AsyncOnSuccessNoException(); diff --git a/tests/Transport/AsyncOnSuccessTest.php b/tests/Transport/AsyncOnSuccessTest.php index e3d6689dc..301f101f8 100644 --- a/tests/Transport/AsyncOnSuccessTest.php +++ b/tests/Transport/AsyncOnSuccessTest.php @@ -23,6 +23,9 @@ class AsyncOnSuccessTest extends TestCase { + protected Psr17Factory $psr17Factory; + protected AsyncOnSuccess $asyncOnSuccess; + public function setUp(): void { $this->asyncOnSuccess = new AsyncOnSuccess();