@@ -31,6 +31,78 @@ protected function finalize()
31
31
AlibabaCloud::cancelMock ();
32
32
}
33
33
34
+ /**
35
+ * @throws ClientException
36
+ */
37
+ public function testAccessKeyIdEmpty ()
38
+ {
39
+ $ this ->expectException (ClientException::class);
40
+ $ this ->expectExceptionMessage ('AccessKey ID cannot be empty ' );
41
+ // Setup
42
+ $ client = new RamRoleArnClient (
43
+ '' ,
44
+ 'access_key_secret ' ,
45
+ 'role_arn ' ,
46
+ 'role_session_name '
47
+ );
48
+ $ provider = new RamRoleArnProvider ($ client );
49
+ $ provider ->get ();
50
+ }
51
+
52
+ /**
53
+ * @throws ClientException
54
+ */
55
+ public function testAccessKeyIdFormat ()
56
+ {
57
+ $ this ->expectException (ClientException::class);
58
+ $ this ->expectExceptionMessage ('AccessKey ID must be a string ' );
59
+ // Setup
60
+ $ client = new RamRoleArnClient (
61
+ null ,
62
+ 'access_key_secret ' ,
63
+ 'role_arn ' ,
64
+ 'role_session_name '
65
+ );
66
+ $ provider = new RamRoleArnProvider ($ client );
67
+ $ provider ->get ();
68
+ }
69
+
70
+ /**
71
+ * @throws ClientException
72
+ */
73
+ public function testAccessKeySecretEmpty ()
74
+ {
75
+ $ this ->expectException (ClientException::class);
76
+ $ this ->expectExceptionMessage ('AccessKey Secret cannot be empty ' );
77
+ // Setup
78
+ $ client = new RamRoleArnClient (
79
+ 'access_key_id ' ,
80
+ '' ,
81
+ 'role_arn ' ,
82
+ 'role_session_name '
83
+ );
84
+ $ provider = new RamRoleArnProvider ($ client );
85
+ $ provider ->get ();
86
+ }
87
+
88
+ /**
89
+ * @throws ClientException
90
+ */
91
+ public function testAccessKeySecretFormat ()
92
+ {
93
+ $ this ->expectException (ClientException::class);
94
+ $ this ->expectExceptionMessage ('AccessKey Secret must be a string ' );
95
+ // Setup
96
+ $ client = new RamRoleArnClient (
97
+ 'access_key_id ' ,
98
+ null ,
99
+ 'role_arn ' ,
100
+ 'role_session_name '
101
+ );
102
+ $ provider = new RamRoleArnProvider ($ client );
103
+ $ provider ->get ();
104
+ }
105
+
34
106
/**
35
107
* @throws ClientException
36
108
*/
@@ -54,7 +126,6 @@ public function testGet()
54
126
} catch (ServerException $ e ) {
55
127
self ::assertEquals ('InvalidAccessKeyId.NotFound ' , $ e ->getErrorCode ());
56
128
}
57
-
58
129
}
59
130
60
131
/**
@@ -91,7 +162,6 @@ public function testGetInCache()
91
162
92
163
// Assert
93
164
self ::assertInstanceOf (StsCredential::class, $ actual );
94
-
95
165
}
96
166
97
167
/**
@@ -108,7 +178,6 @@ public function testNoCredentials()
108
178
109
179
$ provider = new RamRoleArnProvider ($ client );
110
180
$ provider ->get ();
111
-
112
181
}
113
182
114
183
/**
@@ -140,7 +209,5 @@ public function testOk()
140
209
$ provider = new RamRoleArnProvider ($ client );
141
210
$ credential = $ provider ->get ();
142
211
self ::assertInstanceOf (StsCredential::class, $ credential );
143
-
144
212
}
145
-
146
213
}
0 commit comments