Skip to content

Commit 75dbcfe

Browse files
committed
AC-15048::[CE] PHPUnit 12: Upgrade Search & Navigation related test cases | Test Case Improvements
1 parent 395ca26 commit 75dbcfe

File tree

27 files changed

+211
-168
lines changed

27 files changed

+211
-168
lines changed

app/code/Magento/Elasticsearch/Test/Unit/ElasticAdapter/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Resolver/IntegerTypeTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ protected function setUp(): void
5151
}
5252

5353
/**
54+
* @param string $attributeCode
55+
* @param bool $isIntegerType
56+
* @param bool $isBooleanType
57+
* @param string $expected
58+
* @return void
5459
*/
5560
#[DataProvider('getFieldTypeProvider')]
5661
public function testGetFieldType(

app/code/Magento/Elasticsearch/Test/Unit/ElasticAdapter/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Resolver/KeywordTypeTest.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ protected function setUp(): void
5151
}
5252

5353
/**
54+
* @param bool $isComplexType
55+
* @param bool $isSearchable
56+
* @param bool $isAlwaysIndexable
57+
* @param bool $isFilterable
58+
* @param bool $isBoolean
59+
* @param string $expected
60+
* @return void
5461
*/
5562
#[DataProvider('getFieldTypeProvider')]
5663
public function testGetFieldType(

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
use Elasticsearch\Client;
1111
use Elasticsearch\Namespaces\IndicesNamespace;
12+
use Elasticsearch\ClientBuilder;
1213
use Exception;
1314
use Magento\AdvancedSearch\Model\Client\ClientInterface as ElasticsearchClient;
1415
use Magento\AdvancedSearch\Model\Client\ClientOptionsInterface;
@@ -110,7 +111,7 @@ class ElasticsearchTest extends TestCase
110111
*/
111112
protected function setUp(): void
112113
{
113-
if (!class_exists(\Elasticsearch\ClientBuilder::class)) {
114+
if (!class_exists(ClientBuilder::class)) {
114115
$this->markTestSkipped('AC-6597: Skipped as Elasticsearch 8 is configured');
115116
}
116117

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/CopySearchableFieldsToSearchFieldTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ class CopySearchableFieldsToSearchFieldTest extends TestCase
2020
/**
2121
* Test "copy_to" parameter should be added to searchable fields.
2222
*
23+
* @param array $mappingBefore
24+
* @param array $mappingAfter
2325
*/
2426
#[DataProvider('processDataProvider')]
2527
public function testProcess(array $mappingBefore, array $mappingAfter)

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/AttributeAdapterTest.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected function setUp(): void
4646
'usesSource', 'setUsesSource', 'getCustomAttributes', 'setCustomAttributes',
4747
'getCustomAttribute', 'setCustomAttribute']
4848
);
49-
49+
5050
// Create stateful mock data storage
5151
$data = [
5252
'isFilterable' => false,
@@ -57,7 +57,7 @@ protected function setUp(): void
5757
'frontendInput' => 'text',
5858
'usesSource' => false
5959
];
60-
60+
6161
$this->attribute->method('getIsFilterable')->willReturnCallback(function () use (&$data) {
6262
return $data['isFilterable'];
6363
});
@@ -121,6 +121,10 @@ protected function setUp(): void
121121
}
122122

123123
/**
124+
* @param $isFilterable
125+
* @param $isFilterableInSearch
126+
* @param $expected
127+
* @return void
124128
*/
125129
#[DataProvider('isFilterableProvider')]
126130
public function testIsFilterable($isFilterable, $isFilterableInSearch, $expected)
@@ -134,6 +138,12 @@ public function testIsFilterable($isFilterable, $isFilterableInSearch, $expected
134138
}
135139

136140
/**
141+
* @param $isSearchable
142+
* @param $isVisibleInAdvancedSearch
143+
* @param $isFilterable
144+
* @param $isFilterableInSearch
145+
* @param $expected
146+
* @return void
137147
*/
138148
#[DataProvider('isSearchableProvider')]
139149
public function testIsSearchable(
@@ -154,6 +164,8 @@ public function testIsSearchable(
154164
}
155165

156166
/**
167+
* @param $expected
168+
* @return void
157169
*/
158170
#[DataProvider('isAlwaysIndexableProvider')]
159171
public function testIsAlwaysIndexable($expected)
@@ -165,6 +177,9 @@ public function testIsAlwaysIndexable($expected)
165177
}
166178

167179
/**
180+
* @param $backendType
181+
* @param $expected
182+
* @return void
168183
*/
169184
#[DataProvider('isDateTimeTypeProvider')]
170185
public function testIsDateTimeType($backendType, $expected)
@@ -177,6 +192,9 @@ public function testIsDateTimeType($backendType, $expected)
177192
}
178193

179194
/**
195+
* @param $backendType
196+
* @param $expected
197+
* @return void
180198
*/
181199
#[DataProvider('isFloatTypeProvider')]
182200
public function testIsFloatType($backendType, $expected)
@@ -189,6 +207,9 @@ public function testIsFloatType($backendType, $expected)
189207
}
190208

191209
/**
210+
* @param $backendType
211+
* @param $expected
212+
* @return void
192213
*/
193214
#[DataProvider('isIntegerTypeProvider')]
194215
public function testIsIntegerType($backendType, $expected)
@@ -201,6 +222,10 @@ public function testIsIntegerType($backendType, $expected)
201222
}
202223

203224
/**
225+
* @param $frontendInput
226+
* @param $backendType
227+
* @param $expected
228+
* @return void
204229
*/
205230
#[DataProvider('isBooleanTypeProvider')]
206231
public function testIsBooleanType($frontendInput, $backendType, $expected)

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldName/Resolver/PriceTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ protected function setUp(): void
6161
}
6262

6363
/**
64+
* @param $attributeCode
65+
* @param $context
66+
* @param $expected
67+
* @return void
6468
*/
6569
#[DataProvider('getFieldNameProvider')]
6670
public function testGetFieldName($attributeCode, $context, $expected)

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldName/Resolver/SpecialAttributeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ protected function setUp(): void
3838
}
3939

4040
/**
41+
* @param $attributeCode
42+
* @param $expected
43+
* @return void
4144
*/
4245
#[DataProvider('getFieldNameProvider')]
4346
public function testGetFieldName($attributeCode, $expected)

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/ConverterTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ protected function setUp(): void
3737
}
3838

3939
/**
40+
* @param $internalType
41+
* @param $expected
42+
* @return void
4043
*/
4144
#[DataProvider('convertProvider')]
4245
public function testConvert($internalType, $expected)

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Resolver/DateTimeTypeTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ protected function setUp(): void
5050
}
5151

5252
/**
53+
* @param $isDateTimeType
54+
* @param $expected
55+
* @return void
5356
*/
5457
#[DataProvider('getFieldTypeProvider')]
5558
public function testGetFieldType($isDateTimeType, $expected)

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/FieldMapper/Product/FieldProvider/FieldType/Resolver/DefaultResolverTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ protected function setUp(): void
5050
}
5151

5252
/**
53+
* @param $expected
54+
* @return void
5355
*/
5456
#[DataProvider('getFieldTypeProvider')]
5557
public function testGetFieldType($expected)

0 commit comments

Comments
 (0)