Skip to content

Commit 29eb52d

Browse files
committed
AC-15800::[CE] PHPUnit 12: Refactor Inline Anonymous Classes to Helper Classes in PR #2559 & PR#2579 | Catalog Helper Refactoring
1 parent 2a594cb commit 29eb52d

File tree

8 files changed

+35
-345
lines changed

8 files changed

+35
-345
lines changed

app/code/Magento/Catalog/Test/Unit/Helper/CategoryCollectionFactoryTestHelper.php

Lines changed: 0 additions & 43 deletions
This file was deleted.

app/code/Magento/Catalog/Test/Unit/Helper/ProductLinkInterfaceTestHelper.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Copyright 2025 Adobe
3+
* Copyright 2024 Adobe
44
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
@@ -9,6 +9,9 @@
99

1010
use Magento\Catalog\Model\ProductLink\Link;
1111

12+
/**
13+
* Test helper for ProductLink\Link
14+
*/
1215
class ProductLinkInterfaceTestHelper extends Link
1316
{
1417
/**
@@ -28,7 +31,7 @@ class ProductLinkInterfaceTestHelper extends Link
2831

2932
public function __construct()
3033
{
31-
// Empty constructor
34+
// Empty constructor - skip parent dependencies
3235
}
3336

3437
/**
@@ -89,4 +92,3 @@ public function getExtensionAttributes()
8992
return $this->extensionAttributesOverride;
9093
}
9194
}
92-
Lines changed: 30 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,78 @@
11
<?php
22
/**
3-
* Copyright 2025 Adobe
3+
* Copyright 2015 Adobe
44
* All Rights Reserved.
55
*/
66
declare(strict_types=1);
77

88
namespace Magento\Catalog\Test\Unit\Helper;
99

10-
use Magento\Catalog\Model\ResourceModel\Product\Link;
10+
use Magento\Catalog\Model\Product\Link;
1111

12+
/**
13+
* Test helper for Product\Link
14+
*/
1215
class ProductLinkTestHelper extends Link
1316
{
1417
/**
15-
* @var mixed
18+
* @var string
1619
*/
17-
private $linkedProductId = null;
20+
private $linkedProductId;
1821

1922
/**
20-
* @var mixed
23+
* @var array
2124
*/
22-
private $arrayData = null;
25+
private $arrayData = [];
2326

27+
/**
28+
* Skip parent constructor
29+
*/
2430
public function __construct()
2531
{
26-
// Empty constructor
32+
// Intentionally empty - skip parent constructor for testing
2733
}
2834

2935
/**
30-
* @return mixed
36+
* Get linked product ID
37+
*
38+
* @return string
3139
*/
3240
public function getLinkedProductId()
3341
{
3442
return $this->linkedProductId;
3543
}
3644

3745
/**
38-
* @param mixed $id
39-
* @return $this
46+
* Set linked product ID
47+
*
48+
* @param string $id
49+
* @return void
4050
*/
4151
public function setLinkedProductId($id)
4252
{
4353
$this->linkedProductId = $id;
44-
return $this;
4554
}
4655

4756
/**
48-
* @param mixed $keys
49-
* @return mixed
50-
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
57+
* Convert to array
58+
*
59+
* @param array $keys
60+
* @return array
5161
*/
52-
public function toArray($keys = null)
62+
public function toArray(array $keys = [])
5363
{
5464
return $this->arrayData;
5565
}
5666

5767
/**
58-
* @param mixed $data
59-
* @return $this
68+
* Set array data
69+
*
70+
* @param array $data
71+
* @return void
6072
*/
61-
public function setArrayData($data)
73+
public function setArrayData(array $data)
6274
{
6375
$this->arrayData = $data;
64-
return $this;
6576
}
6677
}
6778

app/code/Magento/Catalog/Test/Unit/Helper/ProductOptionsTestHelper.php

Lines changed: 0 additions & 47 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Test/Unit/Helper/AttributeSetCollectionFactoryTestHelper.php

Lines changed: 0 additions & 54 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Test/Unit/Helper/CategoryCollectionFactoryTestHelper.php

Lines changed: 0 additions & 52 deletions
This file was deleted.

app/code/Magento/CatalogImportExport/Test/Unit/Helper/ProductFactoryTestHelper.php

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)