初始化项目:添加后端代码、ThinkPHP框架、前端资源
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Created by PhpStorm.
|
||||
* User: zhangw
|
||||
* Date: 2017/7/17
|
||||
* Time: 下午4:57
|
||||
*/
|
||||
|
||||
include_once '../../Config.php';
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class EndPointByLocationTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $locationService;
|
||||
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
private $clientProfile;
|
||||
|
||||
private function initClient()
|
||||
{
|
||||
# 创建 DefaultAcsClient 实例并初始化
|
||||
$this->clientProfile = DefaultProfile::getProfile(
|
||||
"cn-shanghai", # 您的 Region ID
|
||||
"<your AK>", # 您的 Access Key ID
|
||||
"<your Secret>" # 您的 Access Key Secret
|
||||
);
|
||||
|
||||
$this->locationService = new LocationService($this->clientProfile);
|
||||
}
|
||||
|
||||
public function testFindProductDomain()
|
||||
{
|
||||
$this->initClient();
|
||||
$domain = $this->locationService->findProductDomain("cn-shanghai", "apigateway", "openAPI", "CloudAPI");
|
||||
$this->assertEquals("apigateway.cn-shanghai.aliyuncs.com", $domain);
|
||||
}
|
||||
|
||||
public function testFindProductDomainWithAddEndPoint()
|
||||
{
|
||||
DefaultProfile::addEndpoint("cn-shanghai", "cn-shanghai", "CloudAPI", "apigateway.cn-shanghai123.aliyuncs.com");
|
||||
$this->initClient();
|
||||
$domain = $this->locationService->findProductDomain("cn-shanghai", "apigateway", "openAPI", "CloudAPI");
|
||||
$this->assertEquals("apigateway.cn-shanghai123.aliyuncs.com", $domain);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
include_once '../../Config.php';
|
||||
|
||||
class EndpointProviderTest extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function testFindProductDomain()
|
||||
{
|
||||
$this->assertEquals("ecs.aliyuncs.com", EndpointProvider::findProductDomain("cn-hangzhou", "Ecs"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user