Skip to content

Commit f53b9ca

Browse files
author
Joan He
committed
Merge branch '2.3-develop-pr' of https://github.com/magento-arcticfoxes/magento2ce into 2.3-develop-pr
2 parents 5c6f602 + 4cb44c8 commit f53b9ca

File tree

1 file changed

+56
-39
lines changed

1 file changed

+56
-39
lines changed

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/ElasticsearchTest.php

Lines changed: 56 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class ElasticsearchTest extends \PHPUnit\Framework\TestCase
7777
* Setup
7878
*
7979
* @return void
80+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
8081
*/
8182
protected function setUp()
8283
{
@@ -93,55 +94,65 @@ protected function setUp()
9394
->getMock();
9495
$this->clientConfig = $this->getMockBuilder(\Magento\Elasticsearch\Model\Config::class)
9596
->disableOriginalConstructor()
96-
->setMethods([
97-
'getIndexPrefix',
98-
'getEntityType',
99-
])->getMock();
97+
->setMethods(
98+
[
99+
'getIndexPrefix',
100+
'getEntityType',
101+
]
102+
)->getMock();
100103
$this->indexBuilder = $this->getMockBuilder(\Magento\Elasticsearch\Model\Adapter\Index\BuilderInterface::class)
101104
->disableOriginalConstructor()
102105
->getMock();
103106
$this->logger = $this->getMockBuilder(\Psr\Log\LoggerInterface::class)
104107
->disableOriginalConstructor()
105108
->getMock();
106109
$elasticsearchClientMock = $this->getMockBuilder(\Elasticsearch\Client::class)
107-
->setMethods([
108-
'indices',
109-
'ping',
110-
'bulk',
111-
'search',
112-
])
110+
->setMethods(
111+
[
112+
'indices',
113+
'ping',
114+
'bulk',
115+
'search',
116+
]
117+
)
113118
->disableOriginalConstructor()
114119
->getMock();
115120
$indicesMock = $this->getMockBuilder(\Elasticsearch\Namespaces\IndicesNamespace::class)
116-
->setMethods([
117-
'exists',
118-
'getSettings',
119-
'create',
120-
'putMapping',
121-
'deleteMapping',
122-
'existsAlias',
123-
'updateAliases',
124-
'stats'
125-
])
121+
->setMethods(
122+
[
123+
'exists',
124+
'getSettings',
125+
'create',
126+
'putMapping',
127+
'deleteMapping',
128+
'existsAlias',
129+
'updateAliases',
130+
'stats'
131+
]
132+
)
126133
->disableOriginalConstructor()
127134
->getMock();
128135
$elasticsearchClientMock->expects($this->any())
129136
->method('indices')
130137
->willReturn($indicesMock);
131138
$this->client = $this->getMockBuilder(\Magento\Elasticsearch\Model\Client\Elasticsearch::class)
132-
->setConstructorArgs([
133-
'options' => $this->getClientOptions(),
134-
'elasticsearchClient' => $elasticsearchClientMock
135-
])
139+
->setConstructorArgs(
140+
[
141+
'options' => $this->getClientOptions(),
142+
'elasticsearchClient' => $elasticsearchClientMock
143+
]
144+
)
136145
->getMock();
137146
$this->connectionManager->expects($this->any())
138147
->method('getConnection')
139148
->willReturn($this->client);
140149
$this->fieldMapper->expects($this->any())
141150
->method('getAllAttributesTypes')
142-
->willReturn([
143-
'name' => 'string',
144-
]);
151+
->willReturn(
152+
[
153+
'name' => 'string',
154+
]
155+
);
145156
$this->clientConfig->expects($this->any())
146157
->method('getIndexPrefix')
147158
->willReturn('indexName');
@@ -151,12 +162,14 @@ protected function setUp()
151162
$this->indexNameResolver = $this->getMockBuilder(
152163
\Magento\Elasticsearch\Model\Adapter\Index\IndexNameResolver::class
153164
)
154-
->setMethods([
155-
'getIndexName',
156-
'getIndexNamespace',
157-
'getIndexFromAlias',
158-
'getIndexNameForAlias',
159-
])
165+
->setMethods(
166+
[
167+
'getIndexName',
168+
'getIndexNamespace',
169+
'getIndexFromAlias',
170+
'getIndexNameForAlias',
171+
]
172+
)
160173
->disableOriginalConstructor()
161174
->getMock();
162175
$this->batchDocumentDataMapper = $this->getMockBuilder(
@@ -216,9 +229,11 @@ public function testPrepareDocsPerStore()
216229
{
217230
$this->batchDocumentDataMapper->expects($this->once())
218231
->method('map')
219-
->willReturn([
220-
'name' => 'Product Name',
221-
]);
232+
->willReturn(
233+
[
234+
'name' => 'Product Name',
235+
]
236+
);
222237
$this->assertInternalType(
223238
'array',
224239
$this->model->prepareDocsPerStore(
@@ -352,9 +367,11 @@ public function testConnectException()
352367
{
353368
$connectionManager = $this->getMockBuilder(\Magento\Elasticsearch\SearchAdapter\ConnectionManager::class)
354369
->disableOriginalConstructor()
355-
->setMethods([
356-
'getConnection',
357-
])
370+
->setMethods(
371+
[
372+
'getConnection',
373+
]
374+
)
358375
->getMock();
359376

360377
$connectionManager->expects($this->any())

0 commit comments

Comments
 (0)