Skip to content

Commit 809df8a

Browse files
AC-15635: PHPUnit 12 Upgrade | Incorporated other PR helper changes
1 parent 4ac86e2 commit 809df8a

File tree

12 files changed

+667
-146
lines changed

12 files changed

+667
-146
lines changed

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

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

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@
1515
*/
1616
class AttributeTestHelper extends Attribute
1717
{
18+
/**
19+
* @var mixed
20+
*/
21+
private $searchWeight = null;
22+
1823
/** @var array */
1924
private $attributesByCode = [];
2025
/** @var array */
@@ -127,4 +132,26 @@ public function setScopeGlobal($value)
127132
$this->setData('is_global', $value ? 1 : 0);
128133
return $this;
129134
}
130-
}
135+
136+
/**
137+
* Mock method for getSearchWeight
138+
*
139+
* @return mixed
140+
*/
141+
public function getSearchWeight()
142+
{
143+
return $this->searchWeight;
144+
}
145+
146+
/**
147+
* Set the searchWeight value
148+
*
149+
* @param mixed $value
150+
* @return $this
151+
*/
152+
public function setSearchWeight($value)
153+
{
154+
$this->searchWeight = $value;
155+
return $this;
156+
}
157+
}

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

Lines changed: 13 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -10,79 +10,31 @@
1010
use Magento\Catalog\Model\Category;
1111

1212
/**
13-
* Mock class for Category with URL and product change methods
13+
* TestHelper for Category with dynamic methods
1414
*/
1515
class CategoryTestHelper extends Category
1616
{
17-
/**
18-
* Mock method for getChangedProductIds
19-
*
20-
* @return array
21-
*/
22-
public function getChangedProductIds()
23-
{
24-
return $this->getData('changed_product_ids') ?: [];
25-
}
26-
27-
/**
28-
* Mock method for getUrlPath
29-
*
30-
* @return string|null
31-
*/
32-
public function getUrlPath()
33-
{
34-
return $this->getData('url_path');
35-
}
17+
/** @var array */
18+
private $changedProductIds = [];
3619

37-
/**
38-
* Mock method for setUrlPath
39-
*
40-
* @param string $urlPath
41-
* @return $this
42-
*/
43-
public function setUrlPath($urlPath)
20+
public function __construct()
4421
{
45-
return $this->setData('url_path', $urlPath);
22+
// Skip parent constructor to avoid complex dependencies
4623
}
4724

48-
/**
49-
* Mock method for unsUrlPath (unset url_path)
50-
*
51-
* @return $this
52-
*/
53-
public function unsUrlPath()
54-
{
55-
return $this->unsetData('url_path');
56-
}
57-
58-
/**
59-
* Mock method for getUrlKey
60-
*
61-
* @return string|null
62-
*/
63-
public function getUrlKey()
25+
public function getChangedProductIds()
6426
{
65-
return $this->getData('url_key');
27+
return $this->changedProductIds;
6628
}
6729

68-
/**
69-
* Mock method for setUrlKey
70-
*
71-
* @param string $urlKey
72-
* @return $this
73-
*/
74-
public function setUrlKey($urlKey)
30+
public function setChangedProductIds($value)
7531
{
76-
return $this->setData('url_key', $urlKey);
32+
$this->changedProductIds = $value;
33+
return $this;
7734
}
7835

79-
/**
80-
* Initialize resources
81-
*
82-
* @return void
83-
*/
84-
protected function _construct()
36+
public function __wakeUp()
8537
{
86-
// Mock implementation - no actual resource initialization needed
38+
// Implementation for __wakeUp method
8739
}
88-
}
40+
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,4 @@ public function setValidateResult($value)
4646
$this->validateResult = $value;
4747
return $this;
4848
}
49-
}
49+
}

0 commit comments

Comments
 (0)