MediaWiki REL1_32
ClassCollectorTest.php
Go to the documentation of this file.
1<?php
2
6class ClassCollectorTest extends PHPUnit\Framework\TestCase {
7
8 use MediaWikiCoversValidator;
9
10 public static function provideCases() {
11 return [
12 [
13 "class Foo {}",
14 [ 'Foo' ],
15 ],
16 [
17 "namespace Example;\nclass Foo {}\nclass Bar {}",
18 [ 'Example\Foo', 'Example\Bar' ],
19 ],
20 [
21 "class_alias( 'Foo', 'Bar' );",
22 [ 'Bar' ],
23 ],
24 [
25 "namespace Example;\nclass Foo {}\nclass_alias( 'Example\Foo', 'Foo' );",
26 [ 'Example\Foo', 'Foo' ],
27 ],
28 [
29 "namespace Example;\nclass Foo {}\nclass_alias( 'Example\Foo', 'Bar' );",
30 [ 'Example\Foo', 'Bar' ],
31 ],
32 [
33 "class_alias( Foo::class, 'Bar' );",
34 [ 'Bar' ],
35 ],
36 [
37 // Namespaced class is not currently supported. Must use namespace declaration
38 // earlier in the file.
39 "class_alias( Example\Foo::class, 'Bar' );",
40 [],
41 ],
42 [
43 "namespace Example;\nclass Foo {}\nclass_alias( Foo::class, 'Bar' );",
44 [ 'Example\Foo', 'Bar' ],
45 ],
46 [
47 "new class() extends Foo {}",
48 []
49 ]
50 ];
51 }
52
56 public function testGetClasses( $code, array $classes, $message = null ) {
57 $cc = new ClassCollector();
58 $this->assertEquals( $classes, $cc->getClasses( "<?php\n$code" ), $message );
59 }
60}
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
Definition hooks.txt:895
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))