GroupRepositoryTest.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Store\Api;
  7. use Magento\TestFramework\TestCase\WebapiAbstract;
  8. /**
  9. * Tests for (store) group repository interface.
  10. */
  11. class GroupRepositoryTest extends WebapiAbstract
  12. {
  13. const SERVICE_NAME = 'storeGroupRepositoryV1';
  14. const SERVICE_VERSION = 'V1';
  15. const RESOURCE_PATH = '/V1/store/storeGroups';
  16. /**
  17. * Test getList
  18. */
  19. public function testGetList()
  20. {
  21. $serviceInfo = [
  22. 'rest' => [
  23. 'resourcePath' => self::RESOURCE_PATH,
  24. 'httpMethod' => \Magento\Framework\Webapi\Rest\Request::HTTP_METHOD_GET,
  25. ],
  26. 'soap' => [
  27. 'service' => self::SERVICE_NAME,
  28. 'serviceVersion' => self::SERVICE_VERSION,
  29. 'operation' => self::SERVICE_NAME . 'GetList',
  30. ],
  31. ];
  32. $requestData = [];
  33. $storeGroups = $this->_webApiCall($serviceInfo, $requestData);
  34. $this->assertNotNull($storeGroups);
  35. $this->assertGreaterThan(1, count($storeGroups));
  36. $keys = ['id', 'website_id', 'root_category_id', 'default_store_id', 'name', 'code'];
  37. $this->assertEquals($keys, array_keys($storeGroups[0]));
  38. }
  39. }