|
8 | 8 |
|
9 | 9 | class ValidatorsTest extends TestCase |
10 | 10 | { |
11 | | - public function testWillPassCorrectPayload(): void |
| 11 | + public function testWillValidateStringApiKey(): void |
| 12 | + { |
| 13 | + $this->expectNotToPerformAssertions(); |
| 14 | + $apiKey = '47347801'; |
| 15 | + Validators::validateApiKey($apiKey); |
| 16 | + } |
| 17 | + |
| 18 | + public function testWillValidateIntegerApiKey(): void |
| 19 | + { |
| 20 | + $this->expectNotToPerformAssertions(); |
| 21 | + $apiKey = 47347801; |
| 22 | + Validators::validateApiKey($apiKey); |
| 23 | + } |
| 24 | + |
| 25 | + public function testWillInvalidateApiKey(): void |
| 26 | + { |
| 27 | + $this->expectException(InvalidArgumentException::class); |
| 28 | + $apiKey = [47347801]; |
| 29 | + Validators::validateApiKey($apiKey); |
| 30 | + } |
| 31 | + |
| 32 | + public function testWillValidateApiSecret(): void |
| 33 | + { |
| 34 | + $this->expectNotToPerformAssertions(); |
| 35 | + $secret = 'cdff574f0b071230be098e279d16931116c43fcf'; |
| 36 | + Validators::validateApiSecret($secret); |
| 37 | + } |
| 38 | + |
| 39 | + public function testWillInvalidateApiSecret(): void |
| 40 | + { |
| 41 | + $this->expectException(InvalidArgumentException::class); |
| 42 | + $secret = 3252556; |
| 43 | + Validators::validateApiSecret($secret); |
| 44 | + } |
| 45 | + |
| 46 | + public function testWillValidateApiUrl(): void |
| 47 | + { |
| 48 | + $this->expectNotToPerformAssertions(); |
| 49 | + $apiUrl = 'https://api.opentok.com'; |
| 50 | + Validators::validateApiUrl($apiUrl); |
| 51 | + } |
| 52 | + |
| 53 | + public function testWillInvalidateApiUrl(): void |
| 54 | + { |
| 55 | + $this->expectException(InvalidArgumentException::class); |
| 56 | + |
| 57 | + Validators::validateApiUrl($apiUrl); |
| 58 | + } |
| 59 | + |
| 60 | + public function testWillPassCorrectForceMutePayload(): void |
12 | 61 | { |
13 | 62 | $this->expectNotToPerformAssertions(); |
14 | 63 |
|
@@ -89,6 +138,31 @@ public function testWillFailWhenStreamIdsIsNotArray(): void |
89 | 138 | Validators::validateForceMuteAllOptions($options); |
90 | 139 | } |
91 | 140 |
|
| 141 | + public function testWillValidateWebsocketConfiguration(): void |
| 142 | + { |
| 143 | + $this->expectNotToPerformAssertions(); |
| 144 | + $websocketConfig = [ |
| 145 | + 'uri' => 'ws://valid-websocket', |
| 146 | + 'streams' => [ |
| 147 | + '525503c7-913e-43a1-84b4-31b2e9fe668b', |
| 148 | + '14026813-4f50-4a5a-9b72-fea25430916d' |
| 149 | + ] |
| 150 | + ]; |
| 151 | + Validators::validateWebsocketOptions($websocketConfig); |
| 152 | + } |
| 153 | + |
| 154 | + public function testWillThrowExceptionOnInvalidWebsocketConfiguration(): void |
| 155 | + { |
| 156 | + $this->expectException(InvalidArgumentException::class); |
| 157 | + |
| 158 | + $websocketConfig = [ |
| 159 | + 'streams' => [ |
| 160 | + '525503c7-913e-43a1-84b4-31b2e9fe668b', |
| 161 | + '14026813-4f50-4a5a-9b72-fea25430916d' |
| 162 | + ] |
| 163 | + ]; |
| 164 | + Validators::validateWebsocketOptions($websocketConfig); |
| 165 | + } |
92 | 166 |
|
93 | 167 | /** |
94 | 168 | * @dataProvider resolutionProvider |
|
0 commit comments