<commit_before><?php

namespace Friendica\Test\src\Core;

use Friendica\Core\System;
use PHPUnit\Framework\TestCase;

class SystemTest extends TestCase
{
	private function assertGuid($guid, $length, $prefix = '')
	{
		$length -= strlen($prefix);
		$this->assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
	}

	function testGuidWithoutParameter()
	{
		$guid = System::createGUID();
		$this->assertGuid($guid, 16);
	}

	function testGuidWithSize32() {
		$guid = System::createGUID(32);
		$this->assertGuid($guid, 32);
	}<commit_msg>Fix mock test (remove "implicit" usage of previous Dice-setups)<commit_after><?php

namespace Friendica\Test\src\Core;

use Dice\Dice;
use Friendica\App\BaseURL;
use Friendica\Core\System;
use Friendica\DI;
use PHPUnit\Framework\TestCase;

class SystemTest extends TestCase
{
	protected function setUp()
	{
		parent::setUp();

		$baseUrl = \Mockery::mock(BaseURL::class);
		$baseUrl->shouldReceive('getHostname')->andReturn('friendica.local')->once();
		$dice = \Mockery::mock(Dice::class);
		$dice->shouldReceive('create')->with(BaseURL::class, [])->andReturn($baseUrl);

		DI::init($dice);
	}

	private function assertGuid($guid, $length, $prefix = '')
	{
		$length -= strlen($prefix);
		$this->assertRegExp("/^" . $prefix . "[a-z0-9]{" . $length . "}?$/", $guid);
	}

	function testGuidWithoutParameter()
	{
		$guid = System::createGUID();
		$this->assertGuid($guid, 16);
	}

	function testGuidWithSize32() {
		$guid = System::createGUID(32);
		$this->assertGuid($guid, 32);
	}
{'fraction_non_alphanumeric': 0.1934640522875817, 'fraction_numerical': 0.013071895424836602, 'mean_word_length': 5.051383399209486, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2109686', 'n_tokens_mistral': 577, 'n_tokens_neox': 537, 'n_words': 96}