%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /www/varak.net/wiki.varak.net/extensions/Translate/tests/phpunit/utils/
Upload File :
Create Path :
Current File : /www/varak.net/wiki.varak.net/extensions/Translate/tests/phpunit/utils/MessageGroupStatsTest.php

<?php
/**
 * Unit tests.
 *
 * @author Niklas Laxström
 * @file
 * @license GPL-2.0-or-later
 */

class MessageGroupStatsTest extends PHPUnit\Framework\TestCase {
	public function testGetDatabaseIdForGroupId() {
		$shortId = 'abab';
		$longId = str_repeat( 'ab', 100 );

		$this->assertLessThanOrEqual(
			100,
			strlen( MessageGroupStats::getDatabaseIdForGroupId( $shortId ) ),
			'Short id is <= 100 bytes long'
		);

		$this->assertLessThanOrEqual(
			100,
			strlen( MessageGroupStats::getDatabaseIdForGroupId( $longId ) ),
			'Long id is <= 100 bytes long'
		);

		$longId1 = str_repeat( 'ab', 100 ) . '1';
		$longId2 = str_repeat( 'ab', 100 ) . '2';

		$this->assertNotEquals(
			MessageGroupStats::getDatabaseIdForGroupId( $longId1 ),
			MessageGroupStats::getDatabaseIdForGroupId( $longId2 ),
			'Two long ids with the same prefix do not collide'
		);
	}
}

Zerion Mini Shell 1.0