![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/dev/tests/api-functional/testsuite/Magento/Webapi/Routing/ |
<?php /** * Copyright © Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ /** * Class to test routing based on a Service that exposes subset of operations */ namespace Magento\Webapi\Routing; class SubsetTest extends \Magento\Webapi\Routing\BaseService { /** * @var string */ protected $_version; /** * @var string */ protected $_restResourcePath; /** * @var string */ protected $_soapService; /** * @Override */ protected function setUp(): void { $this->_version = 'V1'; $this->_restResourcePath = "/{$this->_version}/testModule2SubsetRest/"; $this->_soapService = 'testModule2SubsetRestV1'; } /** * @Override * Test get item */ public function testItem() { $itemId = 1; $serviceInfo = [ 'rest' => [ 'resourcePath' => $this->_restResourcePath . $itemId, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'Item'], ]; $requestData = ['id' => $itemId]; $item = $this->_webApiCall($serviceInfo, $requestData); $this->assertEquals($itemId, $item['id'], 'Item was retrieved unsuccessfully'); } /** * @Override * Test fetching all items */ public function testItems() { $itemArr = [['id' => 1, 'name' => 'testItem1'], ['id' => 2, 'name' => 'testItem2']]; $serviceInfo = [ 'rest' => [ 'resourcePath' => $this->_restResourcePath, 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET, ], 'soap' => ['service' => $this->_soapService, 'operation' => $this->_soapService . 'Items'], ]; $item = $this->_webApiCall($serviceInfo); $this->assertEquals($itemArr, $item, 'Items were not retrieved'); } }