File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,10 @@ class RequestSignature implements Plugin
27
27
*/
28
28
public function __construct ($ token , $ secret )
29
29
{
30
+ if (!$ token || !$ secret ) {
31
+ throw new \InvalidArgumentException ('$token and $secret must be set ' );
32
+ }
33
+
30
34
$ this ->token = $ token ;
31
35
$ this ->secret = $ secret ;
32
36
}
Original file line number Diff line number Diff line change @@ -65,4 +65,23 @@ public function testPrefixRequestPathSmoke()
65
65
66
66
$ this ->assertNotNull ($ promise ->wait (true )->getHeader ('Authorization ' )[0 ]);
67
67
}
68
+
69
+ /**
70
+ * @dataProvider tokenSecretProvider
71
+ */
72
+ public function testMissingTokenOrSecret (string $ token , string $ secret ): void
73
+ {
74
+ $ this ->expectException (\InvalidArgumentException::class);
75
+
76
+ new RequestSignature ($ token , $ secret );
77
+ }
78
+
79
+ public function tokenSecretProvider (): array
80
+ {
81
+ return [
82
+ ['' , '' ],
83
+ ['token ' , '' ],
84
+ ['' , 'secret ' ],
85
+ ];
86
+ }
68
87
}
You can’t perform that action at this time.
0 commit comments