3 namespace Friendica\Test\src\Core;
5 use Friendica\Core\System;
6 use PHPUnit\Framework\TestCase;
8 class SystemTest extends TestCase
10 private function assertGuid($guid, $length, $prefix = '')
12 $length -= strlen($prefix);
13 $this->assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
16 function testGuidWithoutParameter()
18 $guid = System::createGUID();
19 $this->assertGuid($guid, 16);
22 function testGuidWithSize32() {
23 $guid = System::createGUID(32);
24 $this->assertGuid($guid, 32);
27 function testGuidWithSize64() {
28 $guid = System::createGUID(64);
29 $this->assertGuid($guid, 64);
32 function testGuidWithPrefix() {
33 $guid = System::createGUID(23, 'test');
34 $this->assertGuid($guid, 23, 'test');