Skip to content

Commit 88745a8

Browse files
authored
Merge pull request magento#7971 from magento-l3/PR_MULTI_NOV_2022
L3 bugfix delivery
2 parents 39f0be8 + 1a2ec51 commit 88745a8

File tree

26 files changed

+1519
-382
lines changed

26 files changed

+1519
-382
lines changed

app/code/Magento/AsynchronousOperations/Controller/Adminhtml/Notification/Dismiss.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
99
use Magento\Backend\App\Action\Context;
1010
use Magento\Backend\App\Action;
11+
use Magento\Framework\App\Action\HttpGetActionInterface;
1112
use Magento\Framework\Controller\ResultFactory;
1213

1314
/**
1415
* Class Bulk Notification Dismiss Controller
1516
*/
16-
class Dismiss extends Action
17+
class Dismiss extends Action implements HttpGetActionInterface
1718
{
1819
/**
1920
* @var BulkNotificationManagement
@@ -43,7 +44,7 @@ protected function _isAllowed()
4344
}
4445

4546
/**
46-
* {@inheritdoc}
47+
* @inheritdoc
4748
*/
4849
public function execute()
4950
{
@@ -55,7 +56,7 @@ public function execute()
5556
$isAcknowledged = $this->notificationManagement->acknowledgeBulks($bulkUuids);
5657

5758
/** @var \Magento\Framework\Controller\Result\Json $result */
58-
$result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
59+
$result = $this->resultFactory->create(ResultFactory::TYPE_RAW);
5960
if (!$isAcknowledged) {
6061
$result->setHttpResponseCode(400);
6162
}

app/code/Magento/AsynchronousOperations/Test/Unit/Controller/Adminhtml/Notification/DismissTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\AsynchronousOperations\Model\BulkNotificationManagement;
1212
use Magento\Framework\App\RequestInterface;
1313
use Magento\Framework\Controller\Result\Json;
14+
use Magento\Framework\Controller\Result\Raw;
1415
use Magento\Framework\Controller\ResultFactory;
1516
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1617
use PHPUnit\Framework\MockObject\MockObject;
@@ -43,6 +44,11 @@ class DismissTest extends TestCase
4344
*/
4445
private $jsonResultMock;
4546

47+
/**
48+
* @var MockObject
49+
*/
50+
private $rawResultMock;
51+
4652
protected function setUp(): void
4753
{
4854
$objectManager = new ObjectManager($this);
@@ -78,10 +84,10 @@ public function testExecute()
7884

7985
$this->resultFactoryMock->expects($this->once())
8086
->method('create')
81-
->with(ResultFactory::TYPE_JSON, [])
82-
->willReturn($this->jsonResultMock);
87+
->with(ResultFactory::TYPE_RAW, [])
88+
->willReturn($this->rawResultMock);
8389

84-
$this->assertEquals($this->jsonResultMock, $this->model->execute());
90+
$this->assertEquals($this->rawResultMock, $this->model->execute());
8591
}
8692

8793
public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedCorrectly()
@@ -95,7 +101,7 @@ public function testExecuteSetsBadRequestResponseStatusIfBulkWasNotAcknowledgedC
95101

96102
$this->resultFactoryMock->expects($this->once())
97103
->method('create')
98-
->with(ResultFactory::TYPE_JSON, [])
104+
->with(ResultFactory::TYPE_RAW, [])
99105
->willReturn($this->jsonResultMock);
100106

101107
$this->notificationManagementMock->expects($this->once())

app/code/Magento/Catalog/Test/Fixture/Product.php

Lines changed: 50 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@
1010
use Magento\Catalog\Api\Data\ProductCustomOptionInterface;
1111
use Magento\Catalog\Api\Data\ProductInterface;
1212
use Magento\Catalog\Api\ProductRepositoryInterface;
13+
use Magento\Catalog\Model\Config\Source\ProductPriceOptionsInterface;
1314
use Magento\Catalog\Model\Product\Attribute\Source\Status;
15+
use Magento\Catalog\Model\Product\Option as CustomOption;
16+
use Magento\Catalog\Model\Product\Option\Value as CustomOptionValue;
1417
use Magento\Catalog\Model\Product\Type;
1518
use Magento\Catalog\Model\Product\Visibility;
1619
use Magento\Framework\DataObject;
@@ -198,21 +201,57 @@ private function prepareOptions(array $data): array
198201
{
199202
$options = [];
200203
$default = [
201-
'product_sku' => $data['sku'],
202-
'title' => 'customoption%order%%uniqid%',
203-
'type' => ProductCustomOptionInterface::OPTION_TYPE_FIELD,
204-
'is_require' => true,
205-
'price' => 10.0,
206-
'price_type' => 'fixed',
207-
'sku' => 'customoption%order%%uniqid%',
208-
'max_characters' => null,
204+
CustomOption::KEY_PRODUCT_SKU => $data['sku'],
205+
CustomOption::KEY_TITLE => 'customoption%order%%uniqid%',
206+
CustomOption::KEY_TYPE => ProductCustomOptionInterface::OPTION_TYPE_FIELD,
207+
CustomOption::KEY_IS_REQUIRE => true,
208+
CustomOption::KEY_PRICE => 10.0,
209+
CustomOption::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED,
210+
CustomOption::KEY_SKU => 'customoption%order%%uniqid%',
211+
CustomOption::KEY_MAX_CHARACTERS => null,
212+
CustomOption::KEY_SORT_ORDER => 1,
209213
'values' => null,
210214
];
215+
$defaultValue = [
216+
CustomOptionValue::KEY_TITLE => 'customoption%order%_%valueorder%%uniqid%',
217+
CustomOptionValue::KEY_PRICE => 1,
218+
CustomOptionValue::KEY_PRICE_TYPE => ProductPriceOptionsInterface::VALUE_FIXED,
219+
CustomOptionValue::KEY_SKU => 'customoption%order%_%valueorder%%uniqid%',
220+
CustomOptionValue::KEY_SORT_ORDER => 1,
221+
];
211222
$sortOrder = 1;
212223
foreach ($data['options'] as $item) {
213-
$option = $item + ['sort_order' => $sortOrder++] + $default;
214-
$option['title'] = strtr($option['title'], ['%order%' => $option['sort_order']]);
215-
$option['sku'] = strtr($option['sku'], ['%order%' => $option['sort_order']]);
224+
$option = $item + [CustomOption::KEY_SORT_ORDER => $sortOrder++] + $default;
225+
$option[CustomOption::KEY_TITLE] = strtr(
226+
$option[CustomOption::KEY_TITLE],
227+
['%order%' => $option[CustomOption::KEY_SORT_ORDER]]
228+
);
229+
$option[CustomOption::KEY_SKU] = strtr(
230+
$option[CustomOption::KEY_SKU],
231+
['%order%' => $option[CustomOption::KEY_SORT_ORDER]]
232+
);
233+
if (isset($item['values'])) {
234+
$valueSortOrder = 1;
235+
$option['values'] = [];
236+
foreach ($item['values'] as $value) {
237+
$value += [CustomOptionValue::KEY_SORT_ORDER => $valueSortOrder++] + $defaultValue;
238+
$value[CustomOptionValue::KEY_TITLE] = strtr(
239+
$value[CustomOptionValue::KEY_TITLE],
240+
[
241+
'%order%' => $option[CustomOption::KEY_SORT_ORDER],
242+
'%valueorder%' => $value[CustomOptionValue::KEY_SORT_ORDER]
243+
]
244+
);
245+
$value[CustomOptionValue::KEY_SKU] = strtr(
246+
$value[CustomOptionValue::KEY_SKU],
247+
[
248+
'%order%' => $option[CustomOption::KEY_SORT_ORDER],
249+
'%valueorder%' => $value[CustomOptionValue::KEY_SORT_ORDER]
250+
]
251+
);
252+
$option['values'][] = $value;
253+
}
254+
}
216255
$options[] = $option;
217256
}
218257

0 commit comments

Comments
 (0)