Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GettersTest.php
Go to the documentation of this file.
1 <?php
6 namespace Magento\Webapi\Routing;
7 
9 
11 {
15  protected $_version;
16 
20  protected $_restResourcePath;
21 
25  protected $_soapService = 'testModule5AllSoapAndRest';
26 
27  protected function setUp()
28  {
29  $this->_version = 'V1';
30  $this->_soapService = "testModule5AllSoapAndRest{$this->_version}";
31  $this->_restResourcePath = "/{$this->_version}/TestModule5/";
32  }
33 
34  public function testGetters()
35  {
36  $itemId = 1;
37  $serviceInfo = [
38  'rest' => [
39  'resourcePath' => $this->_restResourcePath . $itemId,
41  ],
42  'soap' => [
43  'service' => $this->_soapService,
44  'operation' => $this->_soapService . 'Item',
45  ],
46  ];
47  $requestData = [AllSoapAndRest::ID => $itemId];
48  $item = $this->_webApiCall($serviceInfo, $requestData);
49  $this->assertEquals($itemId, $item[AllSoapAndRest::ID], 'Item was retrieved unsuccessfully');
50  $isEnabled = isset($item[AllSoapAndRest::ENABLED]) && $item[AllSoapAndRest::ENABLED] === true;
51  $this->assertTrue($isEnabled, 'Getter with "is" prefix is processed incorrectly.');
52  $hasOrder = isset($item[AllSoapAndRest::HAS_ORDERS]) && $item[AllSoapAndRest::HAS_ORDERS] === true;
53  $this->assertTrue($hasOrder, 'Getter with "has" prefix is processed incorrectly.');
54  }
55 }
_webApiCall( $serviceInfo, $arguments=[], $webApiAdapterCode=null, $storeCode=null, $integration=null)