| Conditions | 1 |
| Paths | 1 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php declare(strict_types = 1); |
||
| 11 | public function testGenerate(): void |
||
| 12 | { |
||
| 13 | $hash = Hashes::generate(); |
||
| 14 | self::assertTrue(strlen($hash) === 32); |
||
| 15 | self::assertTrue((bool) preg_match('#^[a-z0-9]{32}$#', $hash)); |
||
| 16 | |||
| 17 | $anotherHash = Hashes::generate(); |
||
| 18 | self::assertTrue(strlen($anotherHash) === 32); |
||
| 19 | self::assertTrue((bool) preg_match('#^[a-z0-9]{32}$#', $anotherHash)); |
||
| 20 | self::assertNotSame($hash, $anotherHash); |
||
| 21 | |||
| 22 | $customHash = Hashes::generate(10, 'A-Z'); |
||
| 23 | self::assertTrue(strlen($customHash) === 10); |
||
| 24 | self::assertTrue((bool) preg_match('#^[A-Z]{10}$#', $customHash)); |
||
| 25 | } |
||
| 28 |