Skip to content

Commit b437162

Browse files
committed
magento-engcom/bulk-api#4 Support for Async operations in WebAPI
- Fixed integration tests
1 parent 47bbf50 commit b437162

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

app/code/Magento/SwaggerWebapi/Model/SchemaType/Rest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Rest implements SchemaTypeInterface
2222
*
2323
* @param string $code
2424
*/
25-
public function __construct(string $code)
25+
public function __construct(string $code = 'rest')
2626
{
2727
$this->code = $code;
2828
}

app/code/Magento/SwaggerWebapiAsync/Model/SchemaType/Async.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Async implements SchemaTypeInterface
2222
*
2323
* @param string $code
2424
*/
25-
public function __construct(string $code)
25+
public function __construct(string $code = 'async')
2626
{
2727
$this->code = $code;
2828
}

dev/tests/integration/framework/Magento/TestFramework/MessageQueue/PublisherConsumerController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ public function initialize()
7878
if (!$this->getConsumerProcessIds($consumer)) {
7979
exec("{$this->getConsumerStartCommand($consumer, true)} > /dev/null &");
8080
}
81+
sleep(5);
8182
}
8283

8384
if (file_exists($this->logFilePath)) {
@@ -160,7 +161,7 @@ public function waitForAsynchronousResult(callable $condition, $params)
160161
do {
161162
sleep(1);
162163
$assertion = call_user_func_array($condition, $params);
163-
} while (!$assertion && ($i++ < 180));
164+
} while (!$assertion && ($i++ < 20));
164165

165166
if (!$assertion) {
166167
throw new PreconditionFailedException("No asynchronous messages were processed.");

dev/tests/integration/testsuite/Magento/AsynchronousOperations/Model/MassScheduleTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@ protected function setUp()
9696
}
9797

9898
/**
99-
* @magentoAppArea adminhtml
100-
* @magentoDbIsolation enabled
101-
* @magentoAppIsolation enabled
10299
* @dataProvider productDataProvider
103100
* @param ProductInterface[] $products
104101
*/
@@ -129,6 +126,8 @@ public function sendBulk($products)
129126
$this->skus[] = $data['product']->getSku();
130127
}
131128
}
129+
$this->clearProducts();
130+
132131
$result = $this->massSchedule->publishMass('async.V1.products.POST', $products);
133132

134133
//assert bulk accepted with no errors
@@ -188,9 +187,6 @@ public function assertProductExists($productsSkus, $count)
188187
}
189188

190189
/**
191-
* @magentoAppArea adminhtml
192-
* @magentoDbIsolation enabled
193-
* @magentoAppIsolation enabled
194190
* @dataProvider productExceptionDataProvider
195191
* @param ProductInterface[] $products
196192
*/
@@ -272,7 +268,11 @@ public function productDataProvider()
272268
],
273269
'multiple_products' => [
274270
[
275-
['product' => $this->getProduct()],
271+
['product' => $this->getProduct()
272+
->setName('Simple Product 3')
273+
->setSku('unique-simple-product3')
274+
->setMetaTitle('meta title 3')
275+
],
276276
['product' => $this->getProduct()
277277
->setName('Simple Product 2')
278278
->setSku('unique-simple-product2')

0 commit comments

Comments
 (0)