RamTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. namespace AlibabaCloud\Client\Tests\Feature\Product;
  3. use AlibabaCloud\Client\AlibabaCloud;
  4. use AlibabaCloud\Client\Exception\ClientException;
  5. use PHPUnit\Framework\TestCase;
  6. class RamTest extends TestCase
  7. {
  8. /**
  9. * @before
  10. * @throws ClientException
  11. */
  12. protected function initialize()
  13. {
  14. parent::setUp();
  15. AlibabaCloud::accessKeyClient(\getenv('ACCESS_KEY_ID'), \getenv('ACCESS_KEY_SECRET'))
  16. ->asDefaultClient();
  17. }
  18. /**
  19. * @throws ClientException
  20. * @throws \AlibabaCloud\Client\Exception\ServerException
  21. */
  22. public function testRamByCore()
  23. {
  24. $result = AlibabaCloud::rpc()
  25. ->product('ram')
  26. ->version('2015-05-01')
  27. ->method('POST')
  28. ->action('ListAccessKeys')
  29. ->scheme('https')
  30. ->connectTimeout(25)
  31. ->timeout(30)
  32. ->request();
  33. self::assertTrue(isset($result['AccessKeys']));
  34. }
  35. }