/** * */ public function testV5() { $this->assertEquals(5, substr(UUID::v5(UUID::DNS, 'hello'), 14, 1)); $this->assertTrue(in_array(substr(UUID::v5(UUID::DNS, 'hello'), 19, 1), [8, 9, 'a', 'b'])); $this->assertEquals(UUID::v5(UUID::DNS, 'hello'), UUID::v5(UUID::DNS, 'hello')); $this->assertNotEquals(UUID::v5(UUID::DNS, 'hello'), UUID::v5(UUID::URL, 'hello')); $this->assertNotEquals(UUID::v5(UUID::DNS, 'hello'), UUID::v5(UUID::DNS, 'goodbye')); $this->assertTrue(UUID::validate(UUID::v5(UUID::DNS, 'hello'))); }
/** * Checks that the field value is a valid UUID. * * @access protected * @param string $input Field value * @return boolean */ protected function validateUuid($input) { return UUID::validate($input); }
/** * */ public function testUUIDKey() { $uuid = UUIDKey::create(['value' => 'foo']); $this->assertTrue(UUID::validate($uuid->id)); $uuid = UUIDKey::first(); $this->assertTrue(UUID::validate($uuid->id)); }