Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
SubsetTest.php
Go to the documentation of this file.
1 <?php
10 namespace Magento\Webapi\Routing;
11 
13 {
17  protected $_version;
18 
22  protected $_restResourcePath;
23 
27  protected $_soapService;
28 
32  protected function setUp()
33  {
34  $this->_version = 'V1';
35  $this->_restResourcePath = "/{$this->_version}/testModule2SubsetRest/";
36  $this->_soapService = 'testModule2SubsetRestV1';
37  }
38 
43  public function testItem()
44  {
45  $itemId = 1;
46  $serviceInfo = [
47  'rest' => [
48  'resourcePath' => $this->_restResourcePath . $itemId,
50  ],
51  'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'Item'],
52  ];
53  $requestData = ['id' => $itemId];
54  $item = $this->_webApiCall($serviceInfo, $requestData);
55  $this->assertEquals($itemId, $item['id'], 'Item was retrieved unsuccessfully');
56  }
57 
62  public function testItems()
63  {
64  $itemArr = [['id' => 1, 'name' => 'testItem1'], ['id' => 2, 'name' => 'testItem2']];
65  $serviceInfo = [
66  'rest' => [
67  'resourcePath' => $this->_restResourcePath,
69  ],
70  'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'Items'],
71  ];
72 
73  $item = $this->_webApiCall($serviceInfo);
74  $this->assertEquals($itemArr, $item, 'Items were not retrieved');
75  }
76 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)