6class ClassCollectorTest
extends PHPUnit\Framework\TestCase {
8 use MediaWikiCoversValidator;
10 public static function provideCases() {
17 "namespace Example;\nclass Foo {}\nclass Bar {}",
18 [
'Example\Foo',
'Example\Bar' ],
21 "class_alias( 'Foo', 'Bar' );",
25 "namespace Example;\nclass Foo {}\nclass_alias( 'Example\Foo', 'Foo' );",
26 [
'Example\Foo',
'Foo' ],
29 "namespace Example;\nclass Foo {}\nclass_alias( 'Example\Foo', 'Bar' );",
30 [
'Example\Foo',
'Bar' ],
33 "class_alias( Foo::class, 'Bar' );",
39 "class_alias( Example\Foo::class, 'Bar' );",
43 "namespace Example;\nclass Foo {}\nclass_alias( Foo::class, 'Bar' );",
44 [
'Example\Foo',
'Bar' ],
52 public function testGetClasses(
$code, array $classes, $message =
null ) {
54 $this->assertEquals( $classes, $cc->getClasses(
"<?php\n$code" ), $message );
Reads PHP code and returns the FQCN of every class defined within it.
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code