Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
OperationRepositoryInterfaceTest.php
Go to the documentation of this file.
1 <?php
7 declare(strict_types=1);
8 
10 
14 
16 {
17  const RESOURCE_PATH = '/V1/bulk';
18  const SERVICE_NAME = 'asynchronousOperationsOperationRepositoryV1';
19 
23  public function testGetListByBulkStartTime()
24  {
25  $searchCriteria = [
26  'searchCriteria' => [
27  'filter_groups' => [
28  [
29  'filters' => [
30  [
31  'field' => 'start_time',
32  'value' => '2010-10-10 00:00:00',
33  'condition_type' => 'lteq',
34  ],
35  ],
36  ],
37  ],
38  'current_page' => 1,
39  ],
40  ];
41 
42  $serviceInfo = [
43  'rest' => [
44  'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($searchCriteria),
45  'httpMethod' => Request::HTTP_METHOD_GET,
46  ],
47  'soap' => [
48  'service' => self::SERVICE_NAME,
49  'operation' => self::SERVICE_NAME . 'GetList',
50  ],
51  ];
52 
53  $response = $this->_webApiCall($serviceInfo, $searchCriteria);
54 
55  $this->assertArrayHasKey('search_criteria', $response);
56  $this->assertArrayHasKey('total_count', $response);
57  $this->assertArrayHasKey('items', $response);
58 
59  $this->assertEquals($searchCriteria['searchCriteria'], $response['search_criteria']);
60  $this->assertEquals(3, $response['total_count']);
61  $this->assertEquals(3, count($response['items']));
62 
63  foreach ($response['items'] as $item) {
64  $this->assertEquals('bulk-uuid-searchable-6', $item['bulk_uuid']);
65  }
66  }
67 
71  public function testGetList()
72  {
73  $searchCriteria = [
74  'searchCriteria' => [
75  'filter_groups' => [
76  [
77  'filters' => [
78  [
79  'field' => 'bulk_uuid',
80  'value' => 'bulk-uuid-searchable-6',
81  'condition_type' => 'eq',
82  ],
83  ],
84  ],
85  [
86  'filters' => [
87  [
88  'field' => 'status',
90  'condition_type' => 'eq',
91  ],
92  ],
93  ],
94  ],
95  'current_page' => 1,
96  ],
97  ];
98 
99  $serviceInfo = [
100  'rest' => [
101  'resourcePath' => self::RESOURCE_PATH . '?' . http_build_query($searchCriteria),
102  'httpMethod' => Request::HTTP_METHOD_GET,
103  ],
104  'soap' => [
105  'service' => self::SERVICE_NAME,
106  'operation' => self::SERVICE_NAME . 'GetList',
107  ],
108  ];
109 
110  $response = $this->_webApiCall($serviceInfo, $searchCriteria);
111 
112  $this->assertArrayHasKey('search_criteria', $response);
113  $this->assertArrayHasKey('total_count', $response);
114  $this->assertArrayHasKey('items', $response);
115 
116  $this->assertEquals($searchCriteria['searchCriteria'], $response['search_criteria']);
117  $this->assertEquals(1, $response['total_count']);
118  $this->assertEquals(1, count($response['items']));
119 
120  foreach ($response['items'] as $item) {
121  $this->assertEquals('bulk-uuid-searchable-6', $item['bulk_uuid']);
122  }
123  }
124 }
$response
Definition: 404.php:11
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
$searchCriteria