Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / structure / DumpableObjectsTest.php
blob63f1072717ab69d3c28de26755d8866b3b76ef76
1 <?php
3 use MediaWiki\Title\Title;
4 use MediaWiki\User\User;
6 /**
7 * Integration test for T277618.
9 * Add @noVarDump annotations to large properties if these tests fail.
11 * @group Database
12 * @coversNothing
14 class DumpableObjectsTest extends MediaWikiIntegrationTestCase {
15 private function dumpSize( $object ) {
16 $n = 0;
17 ob_start(
18 static function ( $buffer ) use ( &$n ) {
19 $n += strlen( $buffer );
21 4096
23 var_dump( $object );
24 ob_end_flush();
25 return $n;
28 public function testUser() {
29 $u = new User();
30 $u->isAllowed( 'read' );
31 $this->assertLessThan( 100000, $this->dumpSize( $u ) );
34 public function testTitle() {
35 $object = Title::makeTitle( NS_MAIN, 'Test' );
36 $this->assertLessThan( 100000, $this->dumpSize( $object ) );
39 public function testLanguage() {
40 $object = \MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
41 $this->assertLessThan( 100000, $this->dumpSize( $object ) );
44 public function testMessage() {
45 $object = wfMessage( 'jan' );
46 $this->assertLessThan( 100000, $this->dumpSize( $object ) );