|
1 | 1 | <?php
|
2 | 2 | /**
|
3 |
| - * Copyright © Magento, Inc. All rights reserved. |
4 |
| - * See COPYING.txt for license details. |
| 3 | + * Copyright 2015 Adobe |
| 4 | + * All Rights Reserved. |
5 | 5 | */
|
6 | 6 | declare(strict_types=1);
|
7 | 7 |
|
@@ -154,14 +154,7 @@ protected function setUp(): void
|
154 | 154 | $elasticsearchClientMock->expects($this->any())
|
155 | 155 | ->method('indices')
|
156 | 156 | ->willReturn($indicesMock);
|
157 |
| - $this->client = $this->getMockBuilder(Elasticsearch::class) |
158 |
| - ->setConstructorArgs( |
159 |
| - [ |
160 |
| - 'options' => $this->getClientOptions(), |
161 |
| - 'elasticsearchClient' => $elasticsearchClientMock |
162 |
| - ] |
163 |
| - ) |
164 |
| - ->getMock(); |
| 157 | + $this->client = $this->createMock(Elasticsearch::class); |
165 | 158 | $this->connectionManager->expects($this->any())
|
166 | 159 | ->method('getConnection')
|
167 | 160 | ->willReturn($this->client);
|
@@ -300,7 +293,8 @@ public function testPrepareDocsPerStore(): void
|
300 | 293 | public function testAddDocs(): void
|
301 | 294 | {
|
302 | 295 | $this->client->expects($this->once())
|
303 |
| - ->method('bulkQuery'); |
| 296 | + ->method('bulkQuery') |
| 297 | + ->willReturn(['errors' => false]); |
304 | 298 | $this->assertSame(
|
305 | 299 | $this->model,
|
306 | 300 | $this->model->addDocs(
|
@@ -698,24 +692,6 @@ function ($arg1, $arg2) use ($settings) {
|
698 | 692 | $this->emulateCleanIndex();
|
699 | 693 | }
|
700 | 694 |
|
701 |
| - /** |
702 |
| - * Get elasticsearch client options |
703 |
| - * |
704 |
| - * @return array |
705 |
| - */ |
706 |
| - protected function getClientOptions(): array |
707 |
| - { |
708 |
| - return [ |
709 |
| - 'hostname' => 'localhost', |
710 |
| - 'port' => '9200', |
711 |
| - 'timeout' => 15, |
712 |
| - 'index' => 'magento2', |
713 |
| - 'enableAuth' => 1, |
714 |
| - 'username' => 'user', |
715 |
| - 'password' => 'my-password' |
716 |
| - ]; |
717 |
| - } |
718 |
| - |
719 | 695 | /**
|
720 | 696 | * Run Clean Index; Index Name Mock value should be non-nullable for PHP 8.1 compatibility
|
721 | 697 | *
|
|
0 commit comments