X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=tests%2FUUIDTest.php;h=ce330d7ac6d8f1d8f612e22a99acc3f4a6cb3890;hb=586fb5a5175d7a10f5f78dd026434e48202e5451;hp=de256ffa1ff2423b5ce26b7191376901762322c3;hpb=3b5c3d2c8428e1072a2944f0b8adfa79574bf1f6;p=quix0rs-gnu-social.git diff --git a/tests/UUIDTest.php b/tests/UUIDTest.php index de256ffa1f..ce330d7ac6 100644 --- a/tests/UUIDTest.php +++ b/tests/UUIDTest.php @@ -6,7 +6,8 @@ if (isset($_SERVER) && array_key_exists('REQUEST_METHOD', $_SERVER)) { } define('INSTALLDIR', realpath(dirname(__FILE__) . '/..')); -define('STATUSNET', true); +define('GNUSOCIAL', true); +define('STATUSNET', true); // compatibility require_once INSTALLDIR . '/lib/common.php'; @@ -21,5 +22,17 @@ class UUIDTest extends PHPUnit_Framework_TestCase $this->assertEquals(0x4000, hexdec(substr($result, 14, 4)) & 0xF000); $this->assertEquals(0x8000, hexdec(substr($result, 19, 4)) & 0xC000); } + + public function testUnique() + { + $reps = 100; + $ids = array(); + + for ($i = 0; $i < $reps; $i++) { + $ids[] = UUID::gen(); + } + + $this->assertEquals(count($ids), count(array_unique($ids)), "UUIDs must be unique"); + } }