]> git.mxchange.org Git - friendica.git/blob - tests/src/Core/SystemTest.php
Replace x() by isset(), !empty() or defaults()
[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                 print $guid;
13                 $length -= strlen($prefix);
14                 $this->assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
15         }
16
17         function testGuidWithoutParameter()
18         {
19                 $guid = System::createGUID();
20                 $this->assertGuid($guid, 16);
21         }
22
23         function testGuidWithSize32() {
24                 $guid = System::createGUID(32);
25                 $this->assertGuid($guid, 32);
26         }
27
28         function testGuidWithSize64() {
29                 $guid = System::createGUID(64);
30                 $this->assertGuid($guid, 64);
31         }
32
33         function testGuidWithPrefix() {
34                 $guid = System::createGUID(23, 'test');
35                 $this->assertGuid($guid, 23, 'test');
36         }
37 }