CredentialTest.php 786 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace UCloud\Tests;
  3. use PHPUnit\Framework\TestCase;
  4. use UCloud\Core\Credential\Credential;
  5. /**
  6. * Check that credential package is worked.
  7. */
  8. class CredentialTest extends TestCase
  9. {
  10. /**
  11. * Check, that signature algorithm is correct for example
  12. */
  13. public function testExample()
  14. {
  15. $cred = new Credential([
  16. "publicKey" => "ucloudsomeone@example.com1296235120854146120",
  17. "privateKey" => "46f09bb9fab4f12dfc160dae12273d5332b5debe",
  18. ]);
  19. $args = [
  20. "Action" => "DescribeUHostInstance",
  21. "Region" => "cn-bj2",
  22. "Limit" => 10,
  23. ];
  24. $this->assertEquals(
  25. 'cba5cf5ec4d4233d206b1b54951e3787350a642f',
  26. $cred->verifyAc($args)
  27. );
  28. }
  29. }