[FORMAT] Run php-cs-fixer on tests/

This commit is contained in:
Diogo Cordeiro
2020-06-24 13:08:11 +01:00
committed by Diogo Peralta Cordeiro
parent bba9c0d560
commit 81d50c4ec3
19 changed files with 1026 additions and 1024 deletions

View File

@@ -39,23 +39,24 @@ final class UUIDTest extends TestCase
public function testGenerate()
{
$result = UUID::gen();
$this->assertRegExp('/^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$/',
$result);
static::assertRegExp(
'/^[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}$/',
$result
);
// Check version number
$this->assertEquals(0x4000, hexdec(substr($result, 14, 4)) & 0xF000);
$this->assertEquals(0x8000, hexdec(substr($result, 19, 4)) & 0xC000);
static::assertSame(0x4000, hexdec(substr($result, 14, 4)) & 0xF000);
static::assertSame(0x8000, hexdec(substr($result, 19, 4)) & 0xC000);
}
public function testUnique()
{
$reps = 100;
$ids = array();
$ids = [];
for ($i = 0; $i < $reps; $i++) {
for ($i = 0; $i < $reps; ++$i) {
$ids[] = UUID::gen();
}
$this->assertEquals(count($ids), count(array_unique($ids)), "UUIDs must be unique");
static::assertSame(count($ids), count(array_unique($ids)), 'UUIDs must be unique');
}
}