From 0eb717e798ab424b74eb5baca743923ab24a1403 Mon Sep 17 00:00:00 2001 From: Romain Ruaud Date: Wed, 22 Feb 2023 19:06:00 +0100 Subject: [PATCH] ES8 : fix unit tests --- .../Test/Unit/Index/Bulk/BulkResponseTest.php | 13 ++++++------- .../Test/Unit/Index/IndexOperationTest.php | 14 +++++++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/module-elasticsuite-core/Test/Unit/Index/Bulk/BulkResponseTest.php b/src/module-elasticsuite-core/Test/Unit/Index/Bulk/BulkResponseTest.php index 14039da5d..06559f496 100644 --- a/src/module-elasticsuite-core/Test/Unit/Index/Bulk/BulkResponseTest.php +++ b/src/module-elasticsuite-core/Test/Unit/Index/Bulk/BulkResponseTest.php @@ -39,12 +39,12 @@ protected function setUp(): void $error1 = ['type' => 'reason1', 'reason' => 'Reason 1']; $error2 = ['type' => 'reason2', 'reason' => 'Reason 2']; $items = [ - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc1']], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc2']], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc3', 'error' => $error1]], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc4', 'error' => $error1]], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc5', 'error' => $error2]], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc6', 'error' => $error2]], + ['index' => ['_index' => 'index', '_id' => 'doc1']], + ['index' => ['_index' => 'index', '_id' => 'doc2']], + ['index' => ['_index' => 'index', '_id' => 'doc3', 'error' => $error1]], + ['index' => ['_index' => 'index', '_id' => 'doc4', 'error' => $error1]], + ['index' => ['_index' => 'index', '_id' => 'doc5', 'error' => $error2]], + ['index' => ['_index' => 'index', '_id' => 'doc6', 'error' => $error2]], ]; $this->bulkResponse = new BulkResponse(['errors' => true, 'items' => $items]); } @@ -91,7 +91,6 @@ public function testErrorAggregation() foreach ($aggregatedErrors as $currentError) { $this->assertEquals('index', $currentError['index']); - $this->assertEquals('type', $currentError['document_type']); $this->assertEquals('index', $currentError['operation']); $this->assertEquals(2, $currentError['count']); $this->assertCount(2, $currentError['document_ids']); diff --git a/src/module-elasticsuite-core/Test/Unit/Index/IndexOperationTest.php b/src/module-elasticsuite-core/Test/Unit/Index/IndexOperationTest.php index ed401e519..4d58bb16d 100644 --- a/src/module-elasticsuite-core/Test/Unit/Index/IndexOperationTest.php +++ b/src/module-elasticsuite-core/Test/Unit/Index/IndexOperationTest.php @@ -149,12 +149,12 @@ public function testExecuteBulkWithErrors() $this->clientMock->method('bulk')->will($this->returnValue([ 'errors' => true, 'items' => [ - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc1']], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc2']], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc3', 'error' => $error1]], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc4', 'error' => $error1]], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc5', 'error' => $error2]], - ['index' => ['_index' => 'index', '_type' => 'type', '_id' => 'doc6', 'error' => $error2]], + ['index' => ['_index' => 'index', '_id' => 'doc1']], + ['index' => ['_index' => 'index', '_id' => 'doc2']], + ['index' => ['_index' => 'index', '_id' => 'doc3', 'error' => $error1]], + ['index' => ['_index' => 'index', '_id' => 'doc4', 'error' => $error1]], + ['index' => ['_index' => 'index', '_id' => 'doc5', 'error' => $error2]], + ['index' => ['_index' => 'index', '_id' => 'doc6', 'error' => $error2]], ], ])); @@ -166,7 +166,7 @@ public function testExecuteBulkWithErrors() $this->assertArrayHasKey('errors', $this->logRows); $this->assertCount(2, $this->logRows['errors']); $errMessages = [ - 'Bulk index operation failed 2 times in index index for type type.', + 'Bulk index operation failed 2 times in index index.', 'Error (reason2) : Reason 2.', 'Failed doc ids sample : doc5, doc6.', ];