diff --git a/tests/Aggregation/AbstractSimpleAggregationTest.php b/tests/Aggregation/AbstractSimpleAggregationTest.php index 2580fb5822..2e2740917a 100644 --- a/tests/Aggregation/AbstractSimpleAggregationTest.php +++ b/tests/Aggregation/AbstractSimpleAggregationTest.php @@ -1,5 +1,7 @@ _getHost().':'.$this->_getPort()]; - $config['transport_config']['node_pool'] = $config['transport_config']['node_pool'] ?? new TraceableSimpleNodePool( + $config['transport_config']['node_pool'] ??= new TraceableSimpleNodePool( new RoundRobin(), new NoResurrect() ); diff --git a/tests/BasePipeline.php b/tests/BasePipeline.php index 6d0b10c2dc..5737fd4e20 100644 --- a/tests/BasePipeline.php +++ b/tests/BasePipeline.php @@ -1,5 +1,7 @@ assertTrue($action->hasSource()); $expected = <<<'JSON' -{"update":{"_id":"1","_index":"index"}} -{"doc":{"foo":"bar"},"doc_as_upsert":true} -JSON; + {"update":{"_id":"1","_index":"index"}} + {"doc":{"foo":"bar"},"doc_as_upsert":true} + JSON; $this->assertSame($expected, \trim((string) $action)); @@ -81,9 +83,9 @@ public function testUpdateDocumentAsUpsert(): void $action->setDocument($document); $expected = <<<'JSON' -{"update":{"_id":"1","_index":"index"}} -{"doc":{"foo":"bar"}} -JSON; + {"update":{"_id":"1","_index":"index"}} + {"doc":{"foo":"bar"}} + JSON; $this->assertSame($expected, \trim((string) $action)); diff --git a/tests/Bulk/ActionTest.php b/tests/Bulk/ActionTest.php index 644bf6440e..c4200f856a 100644 --- a/tests/Bulk/ActionTest.php +++ b/tests/Bulk/ActionTest.php @@ -1,5 +1,7 @@ assertSame($expectedJson, \trim((string) $bulk)); diff --git a/tests/ClientConfigurationTest.php b/tests/ClientConfigurationTest.php index 5566843811..0e32eb5224 100644 --- a/tests/ClientConfigurationTest.php +++ b/tests/ClientConfigurationTest.php @@ -1,5 +1,7 @@ assertEquals(['query_string' => $expected], $query->toArray()); $fields = []; - $max = \mt_rand(1, 10); + $max = \random_int(1, 10); for ($i = 0; $i < $max; ++$i) { $fields[] = \uniqid(); } diff --git a/tests/Query/RangeTest.php b/tests/Query/RangeTest.php index 71320a7efa..f687b4cf19 100644 --- a/tests/Query/RangeTest.php +++ b/tests/Query/RangeTest.php @@ -1,5 +1,7 @@ hasMethod('__construct')) { $this->assertEmpty($method->getParameters(), 'Constructor is not defined, but method has some parameters'); } else { diff --git a/tests/QueryBuilder/DSL/AggregationTest.php b/tests/QueryBuilder/DSL/AggregationTest.php index a00b792852..5dd9fa4c63 100644 --- a/tests/QueryBuilder/DSL/AggregationTest.php +++ b/tests/QueryBuilder/DSL/AggregationTest.php @@ -1,5 +1,7 @@ getQueries() as $query) { $this->assertTrue( \method_exists($dsl[0], $query), - 'query "'.$query.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[0]) + 'query "'.$query.'" in '.$version::class.' must be defined in '.\get_class($dsl[0]) ); } foreach ($version->getAggregations() as $aggregation) { $this->assertTrue( \method_exists($dsl[1], $aggregation), - 'aggregation "'.$aggregation.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[2]) + 'aggregation "'.$aggregation.'" in '.$version::class.' must be defined in '.\get_class($dsl[2]) ); } foreach ($version->getSuggesters() as $suggester) { $this->assertTrue( \method_exists($dsl[2], $suggester), - 'suggester "'.$suggester.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[2]) + 'suggester "'.$suggester.'" in '.$version::class.' must be defined in '.\get_class($dsl[2]) ); } foreach ($version->getCollapsers() as $collapser) { $this->assertTrue( \method_exists($dsl[3], $collapser), - 'suggester "'.$collapser.'" in '.\get_class($version).' must be defined in '.\get_class($dsl[3]) + 'suggester "'.$collapser.'" in '.$version::class.' must be defined in '.\get_class($dsl[3]) ); } } diff --git a/tests/QueryBuilderTest.php b/tests/QueryBuilderTest.php index ba0660e078..f7d0d28a79 100644 --- a/tests/QueryBuilderTest.php +++ b/tests/QueryBuilderTest.php @@ -1,5 +1,7 @@ getIndicesWithAlias($aliasName); $this->assertEquals([$indexName], \array_map( - static function ($index) { - return $index->getName(); - }, + static fn ($index) => $index->getName(), $indicesWithAlias )); } diff --git a/tests/Suggest/CompletionTest.php b/tests/Suggest/CompletionTest.php index 58df78ee97..7833319fdb 100644 --- a/tests/Suggest/CompletionTest.php +++ b/tests/Suggest/CompletionTest.php @@ -1,5 +1,7 @@