Skip to content

Commit bdc4ccf

Browse files
committed
ACP2E-3544: Async Bulk Operation remains in open state for async.magento.configurableproduct.api.optionrepositoryinterface.save.post
1 parent 181955d commit bdc4ccf

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

app/code/Magento/WebapiAsync/Test/Unit/Controller/Rest/Asynchronous/InputParamsResolverTest.php

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\WebapiAsync\Test\Unit\Controller\Rest\Asynchronous;
99

10+
use Magento\Framework\Reflection\MethodsMap;
1011
use Magento\Framework\Webapi\Rest\Request;
1112
use Magento\Framework\Webapi\ServiceInputProcessor;
1213
use Magento\Framework\Webapi\Validator\EntityArrayValidator\InputArraySizeLimitValue;
@@ -57,6 +58,11 @@ class InputParamsResolverTest extends TestCase
5758
*/
5859
private $inputArraySizeLimitValueMock;
5960

61+
/**
62+
* @var MethodsMap|MockObject
63+
*/
64+
private $methodsMap;
65+
6066
protected function setUp(): void
6167
{
6268
$this->requestMock = $this->createMock(Request::class);
@@ -66,6 +72,7 @@ protected function setUp(): void
6672
$this->requestValidatorMock = $this->createMock(RequestValidator::class);
6773
$this->webapiInputParamsResolverMock = $this->createMock(WebapiInputParamsResolver::class);
6874
$this->inputArraySizeLimitValueMock = $this->createMock(InputArraySizeLimitValue::class);
75+
$this->methodsMap = $this->createMock(MethodsMap::class);
6976
}
7077

7178
#[DataProvider('requestBodyDataProvider')]
@@ -74,9 +81,12 @@ public function testResolveAsyncBulkShouldThrowAnErrorForInvalidRequestData(
7481
string $expectedExceptionMessage
7582
): void {
7683
$routeMock = $this->createMock(Route::class);
77-
$this->webapiInputParamsResolverMock->expects($this->once())
78-
->method('getRoute')
84+
$routeMock->method('getParameters')
85+
->willReturn([]);
86+
$this->webapiInputParamsResolverMock->method('getRoute')
7987
->willReturn($routeMock);
88+
$this->paramsOverriderMock->method('override')
89+
->willReturnArgument(0);
8090
$this->requestMock->expects($this->once())
8191
->method('getRequestData')
8292
->willReturn($requestData);
@@ -89,14 +99,15 @@ public function testResolveAsyncBulk(): void
8999
{
90100
$requestData = [['param1' => 'value1'], ['param1' => 'value1']];
91101
$routeMock = $this->createMock(Route::class);
92-
$routeMock->expects($this->once())
93-
->method('getServiceClass')
102+
$routeMock->method('getServiceClass')
94103
->willReturn('serviceClass');
95-
$routeMock->expects($this->once())
96-
->method('getServiceMethod')
104+
$routeMock->method('getServiceMethod')
97105
->willReturn('serviceMethod');
98-
$this->webapiInputParamsResolverMock->expects($this->once())
99-
->method('getRoute')
106+
$routeMock->method('getParameters')
107+
->willReturn([]);
108+
$this->paramsOverriderMock->method('override')
109+
->willReturnArgument(0);
110+
$this->webapiInputParamsResolverMock->method('getRoute')
100111
->willReturn($routeMock);
101112
$this->requestMock->expects($this->once())
102113
->method('getRequestData')
@@ -139,7 +150,8 @@ private function getModel(bool $isBulk = false): InputParamsResolver
139150
$this->requestValidatorMock,
140151
$this->webapiInputParamsResolverMock,
141152
$isBulk,
142-
$this->inputArraySizeLimitValueMock
153+
$this->inputArraySizeLimitValueMock,
154+
$this->methodsMap
143155
);
144156
}
145157
}

0 commit comments

Comments
 (0)