1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace Yjtec\LaravelCloud\Tests;
use PHPUnit\Framework\TestCase;
use Yjtec\LaravelCloud\YC;
class YCTest extends TestCase{
public function testGatewayHasNoKey(){
$gateway = 'http://www.hnyjkj.com';
$yc = new YC([
'http' => [
'gateway' => [
'uri' => $gateway
]
]
]);
$this->assertEquals($gateway,$yc->gateway());
$this->assertEquals($gateway.'/'.'scenter',$yc->gateway('scenter'));
}
public function testGatewayHasKey(){
$gateway = 'http://www.hnyjkj.com';
$scenter = 'http://inner.scenter.360vrsh.com';
$yc = new YC([
'http' => [
'gateway' => [
'uri' => $gateway
],
'scenter' => [
'gateway' => $scenter
]
]
]);
$this->assertEquals($scenter,$yc->gateway('scenter'));
}
public function testHttp(){
$gateway = 'http://www.hnyjkj.com';
$scenter = 'http://inner.scenter.360vrsh.com';
$yc = new YC([
'http' => [
'gateway' => [
'uri' => $gateway
],
'scenter' => [
'uri' => $scenter
]
]
]);
$this->assertEquals($scenter,$yc->http('scenter'));
}
public function testRpcWithValue(){
$yc = new YC([
'rpc' => [
'scenter' => [
'uri' => 'tcp://89.89.89.89:9000'
]
]
]);
$this->assertEquals('tcp://89.89.89.89:9000',$yc->rpc('scenter'));
}
public function testRpcWithEmpty(){
$yc = new YC([
'rpc' => []
]);
$this->assertEquals('tcp://127.0.0.1',$yc->rpc('scenter'));
}
}