| Total Complexity | 3 |
| Total Lines | 19 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | class RandomTest extends TestCase |
||
| 9 | { |
||
| 10 | public function testRandomStringRespectsLength(): void |
||
| 11 | { |
||
| 12 | $length = 21; |
||
| 13 | $key = Random::string($length); |
||
| 14 | $this->assertEquals($length, strlen($key)); |
||
| 15 | } |
||
| 16 | |||
| 17 | public function testRandomStringValidSymbols(): void |
||
| 18 | { |
||
| 19 | $key = Random::string(100); |
||
| 20 | $this->assertMatchesRegularExpression('/[A-Za-z0-9_-]+/', $key); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function testInvalidLength(): void |
||
| 24 | { |
||
| 25 | $this->expectException(\InvalidArgumentException::class); |
||
| 26 | Random::string(0); |
||
| 27 | } |
||
| 29 |