2021-03-17 01:14:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
2023-12-11 14:59:55 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2023-09-19 12:13:45 +00:00
|
|
|
use MediaWiki\User\User;
|
|
|
|
|
|
2021-03-17 01:14:49 +00:00
|
|
|
/**
|
|
|
|
|
* Integration test for T277618.
|
|
|
|
|
*
|
|
|
|
|
* Add @noVarDump annotations to large properties if these tests fail.
|
|
|
|
|
*
|
2024-10-25 02:39:09 +00:00
|
|
|
* @group Database
|
2021-03-17 01:14:49 +00:00
|
|
|
* @coversNothing
|
|
|
|
|
*/
|
|
|
|
|
class DumpableObjectsTest extends MediaWikiIntegrationTestCase {
|
|
|
|
|
private function dumpSize( $object ) {
|
|
|
|
|
$n = 0;
|
|
|
|
|
ob_start(
|
|
|
|
|
static function ( $buffer ) use ( &$n ) {
|
|
|
|
|
$n += strlen( $buffer );
|
|
|
|
|
},
|
|
|
|
|
4096
|
|
|
|
|
);
|
|
|
|
|
var_dump( $object );
|
|
|
|
|
ob_end_flush();
|
|
|
|
|
return $n;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUser() {
|
2023-07-17 14:08:20 +00:00
|
|
|
$u = new User();
|
2021-03-17 01:14:49 +00:00
|
|
|
$u->isAllowed( 'read' );
|
|
|
|
|
$this->assertLessThan( 100000, $this->dumpSize( $u ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testTitle() {
|
2023-06-19 19:54:57 +00:00
|
|
|
$object = Title::makeTitle( NS_MAIN, 'Test' );
|
2021-03-17 01:14:49 +00:00
|
|
|
$this->assertLessThan( 100000, $this->dumpSize( $object ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testLanguage() {
|
|
|
|
|
$object = \MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
|
|
|
|
|
$this->assertLessThan( 100000, $this->dumpSize( $object ) );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testMessage() {
|
|
|
|
|
$object = wfMessage( 'jan' );
|
|
|
|
|
$this->assertLessThan( 100000, $this->dumpSize( $object ) );
|
|
|
|
|
}
|
|
|
|
|
}
|