From cca7a47dd35729a3ec017f8cbc9ac0979f8582f6 Mon Sep 17 00:00:00 2001 From: Jordi Date: Tue, 23 Jul 2024 11:02:26 +0200 Subject: [PATCH] fix tests --- .../AbstractElasticaToModelTransformerTest.php | 2 +- tests/Unit/Finder/TransformedFinderTest.php | 2 +- .../ElasticaToModelTransformerCollectionTest.php | 6 +++--- .../ModelToElasticaAutoTransformerTest.php | 16 ++++++++-------- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php b/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php index 9550c6d53..e13baab6d 100644 --- a/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php +++ b/tests/Unit/Doctrine/AbstractElasticaToModelTransformerTest.php @@ -166,7 +166,7 @@ public function testHighlightsAreSetOnTransformedObjects($elasticaResults, $doct $results = $transformer->transform($elasticaResults); foreach ($results as $result) { - $this->assertInternalType('array', $result->highlights); + $this->assertIsArray($result->highlights); $this->assertNotEmpty($result->highlights); } } diff --git a/tests/Unit/Finder/TransformedFinderTest.php b/tests/Unit/Finder/TransformedFinderTest.php index 15a1adc22..ab9d79c8c 100644 --- a/tests/Unit/Finder/TransformedFinderTest.php +++ b/tests/Unit/Finder/TransformedFinderTest.php @@ -62,7 +62,7 @@ public function testSearchMethodCreatesAQueryAndReturnsResultsFromSearchableDepe $results = $method->invoke($finder, '', 10); - $this->assertInternalType('array', $results); + $this->assertIsArray($results); } public function testFindPaginatedReturnsAConfiguredPagerfantaObject() diff --git a/tests/Unit/Transformer/ElasticaToModelTransformerCollectionTest.php b/tests/Unit/Transformer/ElasticaToModelTransformerCollectionTest.php index 3ce7d3588..7354c39d6 100644 --- a/tests/Unit/Transformer/ElasticaToModelTransformerCollectionTest.php +++ b/tests/Unit/Transformer/ElasticaToModelTransformerCollectionTest.php @@ -116,12 +116,12 @@ public function testGetIdentifierFieldReturnsAMapOfIdentifiers() { $collection = new ElasticaToModelTransformerCollection([]); $identifiers = $collection->getIdentifierField(); - $this->assertInternalType('array', $identifiers); + $this->assertIsArray($identifiers); $this->assertEmpty($identifiers); $this->collectionSetup(); $identifiers = $this->collection->getIdentifierField(); - $this->assertInternalType('array', $identifiers); + $this->assertIsArray($identifiers); $this->assertSame(['type1' => 'id', 'type2' => 'id'], $identifiers); } @@ -154,7 +154,7 @@ public function testHybridTransformDecoratesResultsWithHybridResultObjects($resu $hybridResults = $collection->hybridTransform([$result]); - $this->assertInternalType('array', $hybridResults); + $this->assertIsArray($hybridResults); $this->assertNotEmpty($hybridResults); $this->assertContainsOnlyInstancesOf(HybridResult::class, $hybridResults); diff --git a/tests/Unit/Transformer/ModelToElasticaAutoTransformerTest.php b/tests/Unit/Transformer/ModelToElasticaAutoTransformerTest.php index d8058dc29..570919cf5 100644 --- a/tests/Unit/Transformer/ModelToElasticaAutoTransformerTest.php +++ b/tests/Unit/Transformer/ModelToElasticaAutoTransformerTest.php @@ -330,7 +330,7 @@ public function testNestedMapping() $data = $document->getData(); $this->assertTrue(array_key_exists('sub', $data)); - $this->assertInternalType('array', $data['sub']); + $this->assertIsArray($data['sub']); $this->assertSame([ ['foo' => 'foo'], ['foo' => 'bar'], @@ -349,7 +349,7 @@ public function tesObjectMapping() $data = $document->getData(); $this->assertTrue(array_key_exists('sub', $data)); - $this->assertInternalType('array', $data['sub']); + $this->assertIsArray($data['sub']); $this->assertSame([ ['bar' => 'foo'], ['bar' => 'bar'], @@ -367,7 +367,7 @@ public function testObjectDoesNotRequireProperties() $data = $document->getData(); $this->assertTrue(array_key_exists('obj', $data)); - $this->assertInternalType('array', $data['obj']); + $this->assertIsArray($data['obj']); $this->assertSame([ 'foo' => 'foo', 'bar' => 'foo', @@ -401,8 +401,8 @@ public function testObjectsMappingOfAtLeastOneAutoMappedObjectAndAtLeastOneManua $this->assertTrue(array_key_exists('obj', $data)); $this->assertTrue(array_key_exists('nestedObject', $data)); - $this->assertInternalType('array', $data['obj']); - $this->assertInternalType('array', $data['nestedObject']); + $this->assertIsArray($data['obj']); + $this->assertIsArray($data['nestedObject']); $this->assertSame( [ 'foo' => 'foo', @@ -475,7 +475,7 @@ public function testThatMappedObjectsDontNeedAnIdentifierField() $data = $document->getData(); $this->assertTrue(array_key_exists('objWithoutIdentifier', $data)); - $this->assertInternalType('array', $data['objWithoutIdentifier']); + $this->assertIsArray($data['objWithoutIdentifier']); $this->assertSame([ 'foo' => 'foo', 'bar' => 'foo', @@ -497,7 +497,7 @@ public function testThatNestedObjectsDontNeedAnIdentifierField() $data = $document->getData(); $this->assertTrue(array_key_exists('subWithoutIdentifier', $data)); - $this->assertInternalType('array', $data['subWithoutIdentifier']); + $this->assertIsArray($data['subWithoutIdentifier']); $this->assertSame([ ['foo' => 'foo', 'bar' => 'foo'], ['foo' => 'bar', 'bar' => 'bar'], @@ -532,7 +532,7 @@ public function testNestedTransformReturnsAnEmptyArrayForNullValues() ]); $data = $document->getData(); - $this->assertInternalType('array', $data['nullValue']); + $this->assertIsArray($data['nullValue']); $this->assertEmpty($data['nullValue']); }