]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/SystemTest.php
Fix Locks
[friendica.git] / tests / src / Core / SystemTest.php
1 <?php
2
3 namespace Friendica\Test\src\Core;
4
5 use Friendica\Core\System;
6 use PHPUnit\Framework\TestCase;
7
8 class SystemTest extends TestCase
9 {
10         private function assertGuid($guid, $length, $prefix = '')
11         {
12                 $length -= strlen($prefix);
13                 $this->assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
14         }
15
16         function testGuidWithoutParameter()
17         {
18                 $guid = System::createGUID();
19                 $this->assertGuid($guid, 16);
20         }
21
22         function testGuidWithSize32() {
23                 $guid = System::createGUID(32);
24                 $this->assertGuid($guid, 32);
25         }
26
27         function testGuidWithSize64() {
28                 $guid = System::createGUID(64);
29                 $this->assertGuid($guid, 64);
30         }
31
32         function testGuidWithPrefix() {
33                 $guid = System::createGUID(23, 'test');
34                 $this->assertGuid($guid, 23, 'test');
35         }
36 }