regionId($regionId) ->name($this->clientName); } /** * Tears down the fixture, for example, close a network connection. * This method is called after a test is executed. * * @after * @throws ClientException */ protected function finalize() { parent::tearDown(); AlibabaCloud::del($this->clientName); } /** * @throws ClientException */ public function testGetSessionCredential() { $this->expectException(ClientException::class); $this->expectExceptionMessage('Timeout or instance does not belong to Alibaba Cloud'); try { (new DescribeRegionsRequest())->client($this->clientName) ->connectTimeout(25) ->timeout(30) ->request(); } catch (ServerException $e) { self::assertContains( $e->getErrorMessage(), [ 'Error in retrieving assume role credentials.', 'The role was not found in the instance', ] ); } } }