public static function createRunId() { $random = uniqid(true) . mt_rand(); if (function_exists('openssl_random_pseudo_bytes')) { $random .= openssl_random_pseudo_bytes(1024); } return hash('sha512', $random . microtime(true) . getmypid() . get_current_user()); }
public function testCreateRunId() { $idOne = Util::createRunId(); $idTwo = Util::createRunId(); $this->assertSame(128, strlen($idOne)); $this->assertSame(128, strlen($idTwo)); $this->assertNotSame($idOne, $idTwo); }