MediaWiki REL1_33
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}
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
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 When $user is not it can be in the form of< username >< more info > e g for bot passwords intended to be added to log contexts Fields it might only if the login was with a bot password 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:856
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))