regionId($regionId) ->name($this->clientName); } /** * @after * @throws ClientException */ protected function finalize() { parent::tearDown(); AlibabaCloud::del($this->clientName); } /** * @throws ClientException */ public function testCCC() { try { (new ListPhoneNumbersRequest()) ->client($this->clientName) ->withInstanceId(\getenv('CC_INSTANCE_ID')) ->withOutboundOnly(true) ->scheme('https') ->host('ccc.cn-shanghai.aliyuncs.com') ->options([ 'verify' => false, ]) ->connectTimeout(25) ->timeout(30) ->request(); } catch (ServerException $e) { $result = $e->getResult(); self::assertEquals( 'InvalidBearerTokenException: Bearertoken has expired', $result['Message'] ); } } /** * @throws ClientException */ public function testEcs() { $this->expectException(ServerException::class); $reg = '/UnsupportedSignatureType: This signature type is not supported./'; if (method_exists($this, 'expectExceptionMessageMatches')) { $this->expectExceptionMessageMatches($reg); } elseif (method_exists($this, 'expectExceptionMessageRegExp')) { $this->expectExceptionMessageRegExp($reg); } (new DescribeAccessPointsRequest()) ->client($this->clientName) ->connectTimeout(25) ->timeout(30) ->request(); } /** * @throws ClientException */ public function testCdn() { $this->expectException(ServerException::class); $reg = '/UnsupportedSignatureType: This signature type is not supported./'; if (method_exists($this, 'expectExceptionMessageMatches')) { $this->expectExceptionMessageMatches($reg); } elseif (method_exists($this, 'expectExceptionMessageRegExp')) { $this->expectExceptionMessageRegExp($reg); } (new DescribeCdnServiceRequest())->client($this->clientName) ->connectTimeout(25) ->timeout(30) ->request(); } }