|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace AsyncAws\Core\Tests\Unit; |
| 4 | + |
| 5 | +use AsyncAws\Core\Credentials\NullProvider; |
| 6 | +use AsyncAws\Core\Sts\Input\AssumeRoleRequest; |
| 7 | +use AsyncAws\Core\Sts\Input\GetCallerIdentityRequest; |
| 8 | +use AsyncAws\Core\Sts\Result\AssumeRoleResponse; |
| 9 | +use AsyncAws\Core\Sts\Result\GetCallerIdentityResponse; |
| 10 | +use AsyncAws\Core\Sts\StsClient; |
| 11 | +use PHPUnit\Framework\TestCase; |
| 12 | +use Symfony\Component\HttpClient\MockHttpClient; |
| 13 | + |
| 14 | +class StsClientTest extends TestCase |
| 15 | +{ |
| 16 | + public function testAssumeRole(): void |
| 17 | + { |
| 18 | + $client = new StsClient([], new NullProvider(), new MockHttpClient()); |
| 19 | + |
| 20 | + $input = new AssumeRoleRequest([ |
| 21 | + 'RoleArn' => 'change me', |
| 22 | + 'RoleSessionName' => 'change me', |
| 23 | + |
| 24 | + ]); |
| 25 | + $result = $client->AssumeRole($input); |
| 26 | + |
| 27 | + self::assertInstanceOf(AssumeRoleResponse::class, $result); |
| 28 | + self::assertFalse($result->info()['resolved']); |
| 29 | + } |
| 30 | + |
| 31 | + public function testGetCallerIdentity(): void |
| 32 | + { |
| 33 | + $client = new StsClient([], new NullProvider(), new MockHttpClient()); |
| 34 | + |
| 35 | + $input = new GetCallerIdentityRequest([ |
| 36 | + |
| 37 | + ]); |
| 38 | + $result = $client->GetCallerIdentity($input); |
| 39 | + |
| 40 | + self::assertInstanceOf(GetCallerIdentityResponse::class, $result); |
| 41 | + self::assertFalse($result->info()['resolved']); |
| 42 | + } |
| 43 | +} |
0 commit comments