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
2727 */
2828 public function __construct ($ token , $ secret )
2929 {
30+ if (!$ token || !$ secret ) {
31+ throw new \InvalidArgumentException ('$token and $secret must be set ' );
32+ }
33+
3034 $ this ->token = $ token ;
3135 $ this ->secret = $ secret ;
3236 }
Original file line number Diff line number Diff line change @@ -65,4 +65,23 @@ public function testPrefixRequestPathSmoke()
6565
6666 $ this ->assertNotNull ($ promise ->wait (true )->getHeader ('Authorization ' )[0 ]);
6767 }
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+ }
6887}
You can’t perform that action at this time.
0 commit comments