12 $this->_version =
'V2';
13 $this->_soapService =
'testModule1AllSoapAndRestV2';
14 $this->_restResourcePath =
"/{$this->_version}/testmodule1/";
25 'resourcePath' => $this->_restResourcePath . $itemId,
28 'soap' => [
'service' => $this->_soapService,
'operation' => $this->_soapService .
'Item'],
33 $this->assertEquals(1,
$item[
'price'],
'Item was retrieved unsuccessfully from V2');
42 [
'id' => 1,
'name' =>
'testProduct1',
'price' =>
'1'],
43 [
'id' => 2,
'name' =>
'testProduct2',
'price' =>
'2'],
47 'resourcePath' => $this->_restResourcePath,
50 'soap' => [
'service' => $this->_soapService,
'operation' => $this->_soapService .
'Items'],
53 $this->assertEquals($itemArr,
$item,
'Items were not retrieved');
66 foreach (
$filters as $filterItemKey => $filterMetadata) {
67 foreach ($filterMetadata as $filterMetaKey => $filterMetaValue) {
68 $paramsDelimiter = empty($restFilter) ?
'?' :
'&';
69 $restFilter .=
"{$paramsDelimiter}filters[{$filterItemKey}][{$filterMetaKey}]={$filterMetaValue}";
74 'resourcePath' => $this->_restResourcePath . $restFilter,
78 'service' => $this->_soapService,
79 'operation' => $this->_soapService .
'Items',
87 $this->assertEquals($expectedResult,
$item,
'Filtration does not seem to work correctly.');
92 $firstItem = [
'id' => 1,
'name' =>
'testProduct1',
'price' => 1];
93 $secondItem = [
'id' => 2,
'name' =>
'testProduct2',
'price' => 2];
95 'Both items filter' => [
97 [
'field' =>
'id',
'conditionType' =>
'eq',
'value' => 1],
98 [
'field' =>
'id',
'conditionType' =>
'eq',
'value' => 2],
100 [$firstItem, $secondItem],
102 'First item filter' => [[[
'field' =>
'id',
'conditionType' =>
'eq',
'value' => 1]], [$firstItem]],
103 'Second item filter' => [[[
'field' =>
'id',
'conditionType' =>
'eq',
'value' => 2]], [$secondItem]],
104 'Empty filter' => [[], [$firstItem, $secondItem]],
116 'resourcePath' => $this->_restResourcePath . $itemId,
119 'soap' => [
'service' => $this->_soapService,
'operation' => $this->_soapService .
'Update'],
121 $requestData = [
'entityItem' => [
'id' => $itemId,
'name' =>
'testName',
'price' =>
'4']];
123 $this->assertEquals(
'Updated' .
$requestData[
'entityItem'][
'name'],
$item[
'name'],
'Item update failed');
134 'resourcePath' => $this->_restResourcePath . $itemId,
137 'soap' => [
'service' => $this->_soapService,
'operation' => $this->_soapService .
'Delete'],
141 $this->assertEquals($itemId,
$item[
'id'],
"Item delete failed");
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)
testItemsWithFilters($filters, $expectedResult)
itemsWithFiltersDataProvider()