Skip to content

Commit 27bf965

Browse files
committed
AC-15051:[CE] PHPUnit 12: Upgrade Product Types related test cases
1 parent 933d338 commit 27bf965

File tree

6 files changed

+81
-201
lines changed

6 files changed

+81
-201
lines changed

app/code/Magento/Bundle/Test/Unit/Observer/InitOptionRendererObserverTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
namespace Magento\Bundle\Test\Unit\Observer;
99

1010
use Magento\Bundle\Observer\InitOptionRendererObserver;
11-
use Magento\Framework\Event\Test\Unit\Helper\ObserverTestHelper;
11+
use Magento\Framework\Event\Observer;
1212
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1313
use Magento\Wishlist\Block\Customer\Wishlist\Item\Options;
1414
use PHPUnit\Framework\MockObject\MockObject;
@@ -39,7 +39,7 @@ class InitOptionRendererObserverTest extends TestCase
3939
private $observer;
4040

4141
/**
42-
* @var ObserverTestHelper
42+
* @var Observer
4343
*/
4444
private $observerMock;
4545

@@ -50,7 +50,7 @@ protected function setUp(): void
5050
{
5151
$this->objectManager = new ObjectManager($this);
5252

53-
$this->observerMock = new ObserverTestHelper();
53+
$this->observerMock = new Observer();
5454

5555
$this->blockMock = $this->createPartialMock(Options::class, ['addOptionsRenderCfg']);
5656

app/code/Magento/ConfigurableProduct/Test/Unit/Observer/HideUnsupportedAttributeTypesTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
use Magento\Framework\Data\Form;
1414
use Magento\Framework\Data\Form\Element\Select;
1515
use Magento\Framework\Event\Observer as EventObserver;
16-
use Magento\Framework\Event\Test\Unit\Helper\ObserverTestHelper;
1716
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1817
use Magento\Framework\Data\Form\Element\Test\Unit\Helper\SelectTestHelper;
1918
use PHPUnit\Framework\MockObject\MockObject;
@@ -94,7 +93,7 @@ function ($name) use ($popup, $productTab) {
9493
*/
9594
private function createEventMock(?MockObject $form = null)
9695
{
97-
$event = new ObserverTestHelper();
96+
$event = new EventObserver();
9897
$event->setForm($form);
9998
return $event;
10099
}

app/code/Magento/Quote/Test/Unit/Helper/ProductOptionTestHelper.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,4 @@ public function setExtensionAttributes($extensionAttributes)
7575
return $this;
7676
}
7777
}
78+

lib/internal/Magento/Framework/Event/Test/Unit/Helper/EventTestHelper.php

Lines changed: 15 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -15,44 +15,9 @@
1515
class EventTestHelper extends Event
1616
{
1717
/**
18-
* @var mixed
18+
* @var array
1919
*/
20-
private $product;
21-
22-
/**
23-
* @var mixed
24-
*/
25-
private $collection;
26-
27-
/**
28-
* @var mixed
29-
*/
30-
private $limit;
31-
32-
/**
33-
* @var mixed
34-
*/
35-
private $items;
36-
37-
/**
38-
* @var mixed
39-
*/
40-
private $store;
41-
42-
/**
43-
* @var mixed
44-
*/
45-
private $result;
46-
47-
/**
48-
* @var mixed
49-
*/
50-
private $quote;
51-
52-
/**
53-
* @var mixed
54-
*/
55-
private $order;
20+
private $data = [];
5621

5722
public function __construct()
5823
{
@@ -66,7 +31,7 @@ public function __construct()
6631
*/
6732
public function getProduct()
6833
{
69-
return $this->product;
34+
return $this->data['product'] ?? null;
7035
}
7136

7237
/**
@@ -77,7 +42,7 @@ public function getProduct()
7742
*/
7843
public function setProduct($product): self
7944
{
80-
$this->product = $product;
45+
$this->data['product'] = $product;
8146
return $this;
8247
}
8348

@@ -88,7 +53,7 @@ public function setProduct($product): self
8853
*/
8954
public function getCollection()
9055
{
91-
return $this->collection;
56+
return $this->data['collection'] ?? null;
9257
}
9358

9459
/**
@@ -99,7 +64,7 @@ public function getCollection()
9964
*/
10065
public function setCollection($collection): self
10166
{
102-
$this->collection = $collection;
67+
$this->data['collection'] = $collection;
10368
return $this;
10469
}
10570

@@ -110,7 +75,7 @@ public function setCollection($collection): self
11075
*/
11176
public function getLimit()
11277
{
113-
return $this->limit;
78+
return $this->data['limit'] ?? null;
11479
}
11580

11681
/**
@@ -121,7 +86,7 @@ public function getLimit()
12186
*/
12287
public function setLimit($limit): self
12388
{
124-
$this->limit = $limit;
89+
$this->data['limit'] = $limit;
12590
return $this;
12691
}
12792

@@ -132,7 +97,7 @@ public function setLimit($limit): self
13297
*/
13398
public function getItems()
13499
{
135-
return $this->items;
100+
return $this->data['items'] ?? null;
136101
}
137102

138103
/**
@@ -143,7 +108,7 @@ public function getItems()
143108
*/
144109
public function setItems($items): self
145110
{
146-
$this->items = $items;
111+
$this->data['items'] = $items;
147112
return $this;
148113
}
149114

@@ -154,7 +119,7 @@ public function setItems($items): self
154119
*/
155120
public function getStore()
156121
{
157-
return $this->store;
122+
return $this->data['store'] ?? null;
158123
}
159124

160125
/**
@@ -164,16 +129,17 @@ public function getStore()
164129
*/
165130
public function getResult()
166131
{
167-
return $this->result;
132+
return $this->data['result'] ?? null;
168133
}
134+
169135
/**
170136
* Get quote (custom method for testing)
171137
*
172138
* @return mixed
173139
*/
174140
public function getQuote()
175141
{
176-
return $this->quote;
142+
return $this->data['quote'] ?? null;
177143
}
178144

179145
/**
@@ -183,6 +149,6 @@ public function getQuote()
183149
*/
184150
public function getOrder()
185151
{
186-
return $this->order;
152+
return $this->data['order'] ?? null;
187153
}
188154
}

lib/internal/Magento/Framework/Event/Test/Unit/Helper/ObserverTestHelper.php

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

0 commit comments

Comments
 (0)