File tree Expand file tree Collapse file tree 3 files changed +150
-1
lines changed
app/code/Magento/Catalog/Test/Unit/Helper
lib/internal/Magento/Framework
App/Test/Unit/Console/Helper Expand file tree Collapse file tree 3 files changed +150
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ class ProductTestHelper extends Product
3737
3838 public function __construct ()
3939 {
40- // Skip parent constructor to avoid dependencies
40+ $ this -> _data = [];
4141 }
4242
4343 /**
@@ -128,4 +128,14 @@ public function getIsRecurring()
128128 {
129129 return $ this ->isRecurring ();
130130 }
131+
132+ /**
133+ * Check if product has options.
134+ *
135+ * @return bool
136+ */
137+ public function hasOptions (): bool
138+ {
139+ return isset ($ this ->_data ['has_options ' ]) && $ this ->_data ['has_options ' ];
140+ }
131141}
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright 2025 Adobe
4+ * All Rights Reserved.
5+ */
6+ declare (strict_types=1 );
7+
8+ namespace Magento \Framework \App \Test \Unit \Console \Helper ;
9+
10+ use Magento \Framework \App \Console \Request ;
11+
12+ /**
13+ * Test helper for Console Request with additional methods for testing.
14+ *
15+ * Extends Console\Request to provide methods which don't exist in the base class.
16+ * PHPUnit 12 removed addMethods() support, so this helper is necessary for unit tests.
17+ */
18+ class RequestTestHelper extends Request
19+ {
20+ /**
21+ * @var bool
22+ */
23+ private $ isPost = false ;
24+
25+ /**
26+ * Constructor.
27+ *
28+ * Skip parent constructor to avoid dependencies.
29+ */
30+ public function __construct ()
31+ {
32+ $ this ->params = [];
33+ }
34+
35+ /**
36+ * Get header value.
37+ *
38+ * Mock implementation for testing purposes. Returns empty string to avoid wishlist logic.
39+ *
40+ * @param string $name
41+ * @return string
42+ * @SuppressWarnings(PHPMD.UnusedFormalParameter)
43+ */
44+ public function getHeader ($ name )
45+ {
46+ return '' ;
47+ }
48+
49+ /**
50+ * Check if request is POST.
51+ *
52+ * @return bool
53+ */
54+ public function isPost (): bool
55+ {
56+ return $ this ->isPost ;
57+ }
58+
59+ /**
60+ * Set POST flag.
61+ *
62+ * @param bool $isPost
63+ * @return $this
64+ */
65+ public function setPost (bool $ isPost ): self
66+ {
67+ $ this ->isPost = $ isPost ;
68+ return $ this ;
69+ }
70+
71+ /**
72+ * Set single parameter.
73+ *
74+ * @param string $key
75+ * @param mixed $value
76+ * @return $this
77+ */
78+ public function setParam (string $ key , $ value ): self
79+ {
80+ $ this ->params [$ key ] = $ value ;
81+ return $ this ;
82+ }
83+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ /**
3+ * Copyright 2025 Adobe
4+ * All Rights Reserved.
5+ */
6+ declare (strict_types=1 );
7+
8+ namespace Magento \Framework \Session \Test \Unit \Helper ;
9+
10+ use Magento \Framework \Session \SessionManager ;
11+
12+ /**
13+ * Test helper for SessionManager with custom affectedItems methods
14+ *
15+ * Only implements custom methods not available in SessionManager
16+ */
17+ class SessionManagerTestHelper extends SessionManager
18+ {
19+ /**
20+ * @var array|null
21+ */
22+ private $ affectedItems = null ;
23+
24+ /**
25+ * Constructor
26+ */
27+ public function __construct ()
28+ {
29+ // Skip parent constructor to avoid dependencies
30+ }
31+
32+ /**
33+ * Get affected items
34+ *
35+ * @return array|null
36+ */
37+ public function getAffectedItems ()
38+ {
39+ return $ this ->affectedItems ;
40+ }
41+
42+ /**
43+ * Set affected items
44+ *
45+ * @param mixed $items
46+ * @return void
47+ */
48+ public function setAffectedItems ($ items )
49+ {
50+ if (is_array ($ items )) {
51+ $ this ->affectedItems = $ items ;
52+ } else {
53+ $ this ->affectedItems = null ;
54+ }
55+ }
56+ }
You can’t perform that action at this time.
0 commit comments