moved get_guid to System::createGUID

This commit is contained in:
Philipp Holzer 2018-07-09 21:38:16 +02:00
parent 3a179860e5
commit c829e43725
No known key found for this signature in database
GPG key ID: 58160D7D6AF942B6
21 changed files with 105 additions and 88 deletions

View file

@ -2,8 +2,6 @@
namespace Friendica\Test\src\Core\Cache;
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Test\DatabaseTest;
use Friendica\Util\DateTimeFormat;
@ -18,20 +16,8 @@ abstract class CacheTest extends DatabaseTest
protected function setUp()
{
global $a;
parent::setUp();
$this->instance = $this->getInstance();
// Reusable App object
$this->app = new App(__DIR__.'/../');
$a = $this->app;
// Default config
Config::set('config', 'hostname', 'localhost');
Config::set('system', 'throttle_limit_day', 100);
Config::set('system', 'throttle_limit_week', 100);
Config::set('system', 'throttle_limit_month', 100);
Config::set('system', 'theme', 'system_theme');
}
function testSimple() {

View file

@ -2,10 +2,7 @@
namespace Friendica\Test\src\Core\Lock;
use Friendica\App;
use Friendica\Core\Config;
use Friendica\Test\DatabaseTest;
use PHPUnit\Framework\TestCase;
abstract class LockTest extends DatabaseTest
{
@ -18,20 +15,8 @@ abstract class LockTest extends DatabaseTest
protected function setUp()
{
global $a;
parent::setUp();
$this->instance = $this->getInstance();
// Reusable App object
$this->app = new App(__DIR__.'/../');
$a = $this->app;
// Default config
Config::set('config', 'hostname', 'localhost');
Config::set('system', 'throttle_limit_day', 100);
Config::set('system', 'throttle_limit_week', 100);
Config::set('system', 'throttle_limit_month', 100);
Config::set('system', 'theme', 'system_theme');
}
public function testLock() {

View file

@ -0,0 +1,25 @@
<?php
namespace Friendica\Test\src\Core;
use Friendica\Core\System;
use PHPUnit\Framework\TestCase;
class SystemTest extends TestCase
{
private function assertGuid($guid, $length)
{
$this->assertRegExp("/^[a-z0-9]{" . $length . "}?$/", $guid);
}
function testGuidWithoutParameter()
{
$guid = System::createGUID();
$this->assertGuid($guid, 16);
}
function testGuidWithSize() {
$guid = System::createGUID(20);
$this->assertGuid($guid, 20);
}
}