WebsiteRepositoryTest.php 1.2 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 website repository interface.
  10. */
  11. class WebsiteRepositoryTest extends WebapiAbstract
  12. {
  13. const SERVICE_NAME = 'storeWebsiteRepositoryV1';
  14. const SERVICE_VERSION = 'V1';
  15. const RESOURCE_PATH = '/V1/store/websites';
  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. $websites = $this->_webApiCall($serviceInfo, $requestData);
  34. $this->assertNotNull($websites);
  35. $this->assertGreaterThan(1, count($websites));
  36. $keys = ['id', 'code', 'name', 'default_group_id'];
  37. $this->assertEquals($keys, array_keys($websites[0]));
  38. }
  39. }