Skip to content

Commit 10f6508

Browse files
ShradddhaShradddha
authored andcommitted
AC-12092:: Remove Deprecations- PhpUnit10 Unit Tests
1 parent 5d087f2 commit 10f6508

File tree

57 files changed

+131
-130
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+131
-130
lines changed

app/code/Magento/ConfigurableImportExport/Test/Unit/Model/Export/RowCustomizerTest.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class RowCustomizerTest extends TestCase
4242
/**
4343
* @var int
4444
*/
45-
private $productId = 11;
45+
private static $productId = 11;
4646

4747
protected function setUp(): void
4848
{
@@ -89,10 +89,10 @@ public function testAddData(array $expected, array $data)
8989
/**
9090
* @return array
9191
*/
92-
public function addDataDataProvider()
92+
public static function addDataDataProvider()
9393
{
94-
$expectedConfigurableData = $this->getExpectedConfigurableData();
95-
$data = $expectedConfigurableData[$this->productId];
94+
$expectedConfigurableData = self::getExpectedConfigurableData();
95+
$data = $expectedConfigurableData[self::$productId];
9696

9797
return [
9898
[
@@ -124,7 +124,7 @@ public function addDataDataProvider()
124124
'key_2' => 'value_2',
125125
'key_3' => 'value_3'
126126
],
127-
'product_id' => $this->productId
127+
'product_id' => self::$productId
128128
]
129129
]
130130
];
@@ -212,7 +212,7 @@ private function initConfigurableData()
212212

213213
$productMock->expects(static::any())
214214
->method('getId')
215-
->willReturn($this->productId);
215+
->willReturn(self::$productId);
216216
$productMock->expects(static::any())
217217
->method('getTypeInstance')
218218
->willReturn($this->configurableProductTypeMock);
@@ -243,10 +243,10 @@ private function initConfigurableData()
243243
*
244244
* @return array
245245
*/
246-
private function getExpectedConfigurableData()
246+
private static function getExpectedConfigurableData()
247247
{
248248
return [
249-
$this->productId => [
249+
self::$productId => [
250250
'configurable_variations' => implode(
251251
ImportProduct::PSEUDO_MULTI_LINE_SEPARATOR,
252252
[

app/code/Magento/ConfigurableProduct/Test/Unit/Ui/DataProvider/Product/Form/Modifier/ConfigurablePriceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function testModifyMeta($metaInput, $metaOutput)
3939
/**
4040
* @return array
4141
*/
42-
public function metaDataProvider()
42+
public static function metaDataProvider()
4343
{
4444
$priceComponentConfig = [
4545
'arguments' => [

app/code/Magento/Cron/Test/Unit/Model/Config/XsdTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function testInvalidXmlFile($xmlFile, $expectedErrors)
6969
/**
7070
* @return array
7171
*/
72-
public function invalidXmlFileDataProvider()
72+
public static function invalidXmlFileDataProvider()
7373
{
7474
return [
7575
[

app/code/Magento/CustomerImportExport/Test/Unit/Model/Import/CustomerCompositeTest.php

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121
use Magento\Framework\Filesystem\Directory\Write;
2222
use Magento\Framework\Filesystem\Driver\File;
2323
use Magento\Framework\Filesystem\File\Read;
24-
use Magento\Framework\Serialize\Serializer\Json;
2524
use Magento\Framework\Stdlib\StringUtils;
26-
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
2725
use Magento\Framework\Translate\InlineInterface;
2826
use Magento\ImportExport\Model\Import;
2927
use Magento\ImportExport\Model\Import\AbstractSource;
@@ -179,14 +177,6 @@ protected function setUp(): void
179177
*/
180178
protected function _createModelMock($data)
181179
{
182-
$objectManager = new ObjectManager($this);
183-
$objects = [
184-
[
185-
Json::class,
186-
$this->createMock(Json::class)
187-
]
188-
];
189-
$objectManager->prepareObjectManager($objects);
190180
return new CustomerComposite(
191181
$this->_string,
192182
$this->_scopeConfigMock,

app/code/Magento/Directory/Test/Unit/Model/CurrencyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ function (array $args) {
136136
*
137137
* @return array
138138
*/
139-
public function getOutputFormatDataProvider(): array
139+
public static function getOutputFormatDataProvider(): array
140140
{
141141
$ar_DZ = "\u{062C}.\u{0645}.\u{200F}\u{00A0}%s";
142142
if (version_compare(PHP_VERSION, '8.3', '>=')) {

app/code/Magento/Email/Test/Unit/Model/Template/ConfigTest.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
class ConfigTest extends TestCase
2424
{
25-
private $designParams = [
25+
private static $designParams = [
2626
'area' => Area::AREA_FRONTEND,
2727
'theme' => 'Magento/blank',
2828
'locale' => Locale::DEFAULT_SYSTEM_LOCALE,
@@ -206,7 +206,7 @@ public function testParseTemplateIdParts($input, $expectedOutput)
206206
/**
207207
* @return array
208208
*/
209-
public function parseTemplateCodePartsDataProvider()
209+
public static function parseTemplateCodePartsDataProvider()
210210
{
211211
return [
212212
'Template ID with no theme' => [
@@ -254,13 +254,13 @@ public function testGetTemplateFilenameWithParams()
254254
'getEmailTemplateFileName'
255255
)->with(
256256
'one.html',
257-
$this->designParams,
257+
self::$designParams,
258258
'Fixture_ModuleOne'
259259
)->willReturn(
260260
'_files/Fixture/ModuleOne/view/frontend/email/one.html'
261261
);
262262

263-
$actualResult = $this->model->getTemplateFilename('template_one', $this->designParams);
263+
$actualResult = $this->model->getTemplateFilename('template_one', self::$designParams);
264264
$this->assertEquals('_files/Fixture/ModuleOne/view/frontend/email/one.html', $actualResult);
265265
}
266266

@@ -276,8 +276,8 @@ public function testGetTemplateFilenameWithNoParams()
276276
)->with(
277277
'one.html',
278278
[
279-
'area' => $this->designParams['area'],
280-
'module' => $this->designParams['module'],
279+
'area' => self::$designParams['area'],
280+
'module' => self::$designParams['module'],
281281
],
282282
'Fixture_ModuleOne'
283283
)->willReturn(
@@ -296,10 +296,10 @@ public function testGetTemplateFilenameWrongFileName(): void
296296
$this->expectException('UnexpectedValueException');
297297
$this->expectExceptionMessage('Template file \'one.html\' is not found');
298298
$this->viewFileSystem->expects($this->once())->method('getEmailTemplateFileName')
299-
->with('one.html', $this->designParams, 'Fixture_ModuleOne')
299+
->with('one.html', self::$designParams, 'Fixture_ModuleOne')
300300
->willReturn(false);
301301

302-
$this->model->getTemplateFilename('template_one', $this->designParams);
302+
$this->model->getTemplateFilename('template_one', self::$designParams);
303303
}
304304

305305
/**
@@ -321,13 +321,13 @@ public function testGetterMethodUnknownTemplate($getterMethod, $argument = null)
321321
/**
322322
* @return array
323323
*/
324-
public function getterMethodUnknownTemplateDataProvider()
324+
public static function getterMethodUnknownTemplateDataProvider()
325325
{
326326
return [
327327
'label getter' => ['getTemplateLabel'],
328328
'type getter' => ['getTemplateType'],
329329
'module getter' => ['getTemplateModule'],
330-
'file getter' => ['getTemplateFilename', $this->designParams],
330+
'file getter' => ['getTemplateFilename', self::$designParams],
331331
];
332332
}
333333

@@ -371,7 +371,7 @@ public function testGetterMethodUnknownField(
371371
/**
372372
* @return array
373373
*/
374-
public function getterMethodUnknownFieldDataProvider()
374+
public static function getterMethodUnknownFieldDataProvider()
375375
{
376376
return [
377377
'label getter' => ['getTemplateLabel', "Field 'label' is not defined for email template 'fixture'."],
@@ -384,13 +384,13 @@ public function getterMethodUnknownFieldDataProvider()
384384
'getTemplateFilename',
385385
"Field 'module' is not defined for email template 'fixture'.",
386386
[],
387-
$this->designParams,
387+
self::$designParams,
388388
],
389389
'file getter, unknown file' => [
390390
'getTemplateFilename',
391391
"Field 'file' is not defined for email template 'fixture'.",
392392
['module' => 'Fixture_Module'],
393-
$this->designParams,
393+
self::$designParams,
394394
],
395395
];
396396
}

app/code/Magento/Email/Test/Unit/Model/Template/SenderResolverTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public function testResolveThrowException(array $sender): void
9898
/**
9999
* @return array
100100
*/
101-
public function dataProvidedSenderArray()
101+
public static function dataProvidedSenderArray()
102102
{
103103
return [
104104
[

app/code/Magento/Email/Test/Unit/ViewModel/Template/Preview/FormTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function testGetFormFieldsMissingParameter(string $httpMethod, array $htt
8989
/**
9090
* @return array
9191
*/
92-
public function getFormFieldsDataProvider()
92+
public static function getFormFieldsDataProvider()
9393
{
9494
return [
9595
'get_request_valid' => [
@@ -132,7 +132,7 @@ public function getFormFieldsDataProvider()
132132
/**
133133
* @return array
134134
*/
135-
public function getFormFieldsInvalidDataProvider()
135+
public static function getFormFieldsInvalidDataProvider()
136136
{
137137
return [
138138
'get_request_missing_id' => [

app/code/Magento/Fedex/Test/Unit/Model/Config/Backend/FedexUrlTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public function testBeforeSaveErrors(string $data): void
102102
*
103103
* @return array
104104
*/
105-
public function validDataProvider(): array
105+
public static function validDataProvider(): array
106106
{
107107
return [
108108
[],

app/code/Magento/Fedex/Test/Unit/Plugin/Block/DataProviders/Tracking/ChangeTitleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function testAfterGetTitle(string $carrierCode, string $originalResult, $
7070
*
7171
* @return array
7272
*/
73-
public function testAfterGetTitleDataProvider(): array
73+
public static function testAfterGetTitleDataProvider(): array
7474
{
7575
return [
7676
[Carrier::CODE, 'Original Title', __('Expected Delivery:')],

0 commit comments

Comments
 (0)