Skip to content

Commit 33b33e9

Browse files
committed
Add Tests for operation statuses endpoint
1 parent 89179be commit 33b33e9

File tree

3 files changed

+57
-3
lines changed

3 files changed

+57
-3
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
declare(strict_types=1);
8+
9+
namespace Magento\AsynchronousOperations\Api;
10+
11+
use Magento\TestFramework\TestCase\WebapiAbstract;
12+
use Magento\Framework\Bulk\OperationInterface;
13+
14+
class BulkStatusInterfaceTest extends WebapiAbstract
15+
{
16+
const RESOURCE_PATH = '/V1/bulk/';
17+
const SERVICE_NAME = 'asynchronousOperationsBulkStatusV1';
18+
const TEST_UUID = "bulk-uuid-searchable-6";
19+
20+
/**
21+
* @magentoApiDataFixture Magento/AsynchronousOperations/_files/operation_searchable.php
22+
*/
23+
public function testGetListByBulkStartTime()
24+
{
25+
26+
$serviceInfo = [
27+
'rest' => [
28+
'resourcePath' => self::RESOURCE_PATH . self::TEST_UUID . "/operation-status/" . OperationInterface::STATUS_TYPE_OPEN,
29+
'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET
30+
],
31+
'soap' => [
32+
'service' => self::SERVICE_NAME,
33+
'operation' => self::SERVICE_NAME . 'Get',
34+
],
35+
];
36+
$qty = $this->_webApiCall($serviceInfo);
37+
$this->assertEquals(2, $qty);
38+
}
39+
}

dev/tests/api-functional/testsuite/Magento/AsynchronousOperations/Api/OperationRepositoryInterfaceTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public function testGetListByBulkStartTime()
5757
$this->assertArrayHasKey('items', $response);
5858

5959
$this->assertEquals($searchCriteria['searchCriteria'], $response['search_criteria']);
60-
$this->assertEquals(3, $response['total_count']);
61-
$this->assertEquals(3, count($response['items']));
60+
$this->assertEquals(5, $response['total_count']);
61+
$this->assertEquals(5, count($response['items']));
6262

6363
foreach ($response['items'] as $item) {
6464
$this->assertEquals('bulk-uuid-searchable-6', $item['bulk_uuid']);

dev/tests/integration/testsuite/Magento/AsynchronousOperations/_files/operation_searchable.php

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,22 @@
5252
'error_code' => 2222,
5353
'result_message' => 'Entity with ID=4 does not exist',
5454
],
55-
55+
[
56+
'bulk_uuid' => 'bulk-uuid-searchable-6',
57+
'topic_name' => 'topic-5',
58+
'serialized_data' => json_encode(['entity_id' => 5]),
59+
'status' => OperationInterface::STATUS_TYPE_OPEN,
60+
'error_code' => null,
61+
'result_message' => '',
62+
],
63+
[
64+
'bulk_uuid' => 'bulk-uuid-searchable-6',
65+
'topic_name' => 'topic-5',
66+
'serialized_data' => json_encode(['entity_id' => 5]),
67+
'status' => OperationInterface::STATUS_TYPE_OPEN,
68+
'error_code' => null,
69+
'result_message' => '',
70+
]
5671
];
5772

5873
$bulkQuery = "INSERT INTO {$bulkTable} (`uuid`, `user_id`, `description`, `operation_count`, `start_time`)"

0 commit comments

Comments
 (0)