Dumping many kinds of object with var_dump() leads to dumping the whole address space, because a chain of references leads to MediaWikiServices. So, introduce a trait which replaces the problematic properties with a placeholder, if their doc comment contains @noVarDump. Bug: T277618 Change-Id: Ifa685c26fbc5317d0359544289ec3f433ec4fedf
34 lines
626 B
PHP
34 lines
626 B
PHP
<?php
|
|
|
|
namespace Wikimedia\DebugInfo;
|
|
|
|
/**
|
|
* @covers \Wikimedia\DebugInfo\Placeholder
|
|
*/
|
|
class PlaceholderTest extends \PHPUnit\Framework\TestCase {
|
|
public function provideConstruct() {
|
|
return [
|
|
[
|
|
new \stdClass,
|
|
'/^stdClass#[0-9]*$/'
|
|
],
|
|
[
|
|
1,
|
|
'/^integer$/'
|
|
],
|
|
[
|
|
'test',
|
|
'/^string$/',
|
|
]
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @dataProvider provideConstruct
|
|
*/
|
|
public function testConstruct( $input, $expected ) {
|
|
$placeholder = new Placeholder( $input );
|
|
$this->assertInstanceOf( Placeholder::class, $placeholder );
|
|
$this->assertMatchesRegularExpression( $expected, $placeholder->desc );
|
|
}
|
|
}
|