Debian Codegraph @

tests/phpunit/structure/DumpableObjectsTest.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\Title\Title;
4 use MediaWiki\User\User;
5
6 /**
7 * Integration test for T277618.
8 *
9 * Add @noVarDump annotations to large properties if these tests fail.
10 *
11 * @group Database
12 * @coversNothing
13 */
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 );
20 },
21 4096
22 );
23 var_dump( $object );
24 ob_end_flush();
25 return $n;
26 }
27
28 public function testUser() {
29 $u = new User();
30 $u->isAllowed( 'read' );
31 $this->assertLessThan( 100000, $this->dumpSize( $u ) );
32 }
33
34 public function testTitle() {
35 $object = Title::makeTitle( NS_MAIN, 'Test' );
36 $this->assertLessThan( 100000, $this->dumpSize( $object ) );
37 }
38
39 public function testLanguage() {
40 $object = \MediaWiki\MediaWikiServices::getInstance()->getLanguageFactory()->getLanguage( 'en' );
41 $this->assertLessThan( 100000, $this->dumpSize( $object ) );
42 }
43
44 public function testMessage() {
45 $object = wfMessage( 'jan' );
46 $this->assertLessThan( 100000, $this->dumpSize( $object ) );
47 }
48 }