rdbms: Rename "memCache" to "memStash" in LBFactory
[mediawiki.git] / tests / phpunit / includes / utils / ClassCollectorTest.php
blobe8a228e314a4edb766d4f2e1642c61d879d1699b
1 <?php
3 /**
4 * @covers ClassCollector
5 */
6 class ClassCollectorTest extends PHPUnit_Framework_TestCase {
8 public static function provideCases() {
9 return [
11 "class Foo {}",
12 [ 'Foo' ],
15 "namespace Example;\nclass Foo {}\nclass Bar {}",
16 [ 'Example\Foo', 'Example\Bar' ],
19 "class_alias( 'Foo', 'Bar' );",
20 [ 'Bar' ],
23 "namespace Example;\nclass Foo {}\nclass_alias( 'Example\Foo', 'Foo' );",
24 [ 'Example\Foo', 'Foo' ],
27 "namespace Example;\nclass Foo {}\nclass_alias( 'Example\Foo', 'Bar' );",
28 [ 'Example\Foo', 'Bar' ],
31 "class_alias( Foo::class, 'Bar' );",
32 [ 'Bar' ],
35 "namespace Example;\nclass Foo {}\nclass_alias( Foo::class, 'Bar' );",
36 [ 'Example\Foo', 'Bar' ],
41 /**
42 * @dataProvider provideCases
44 public function testGetClasses( $code, array $classes, $message = null ) {
45 $cc = new ClassCollector();
46 $this->assertEquals( $classes, $cc->getClasses( "<?php\n$code" ), $message );