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 = '')
13 $length -= strlen($prefix);
14 $this->assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
17 function testGuidWithoutParameter()
19 $guid = System::createGUID();
20 $this->assertGuid($guid, 16);
23 function testGuidWithSize32() {
24 $guid = System::createGUID(32);
25 $this->assertGuid($guid, 32);
28 function testGuidWithSize64() {
29 $guid = System::createGUID(64);
30 $this->assertGuid($guid, 64);
33 function testGuidWithPrefix() {
34 $guid = System::createGUID(23, 'test');
35 $this->assertGuid($guid, 23, 'test');