MediaWiki REL1_33
ExtensionsTestSuite.php
Go to the documentation of this file.
1<?php
8class ExtensionsTestSuite extends PHPUnit_Framework_TestSuite {
9 public function __construct() {
10 parent::__construct();
11
12 $paths = [];
13 // Autodiscover extension unit tests
15 foreach ( $registry->getAllThings() as $info ) {
16 $paths[] = dirname( $info['path'] ) . '/tests/phpunit';
17 }
18 // Extensions can return a list of files or directories
19 Hooks::run( 'UnitTestsList', [ &$paths ] );
20 foreach ( array_unique( $paths ) as $path ) {
21 if ( is_dir( $path ) ) {
22 // If the path is a directory, search for test cases.
23 // @since 1.24
24 $suffixes = [ 'Test.php' ];
25 $fileIterator = new File_Iterator_Facade();
26 $matchingFiles = $fileIterator->getFilesAsArray( $path, $suffixes );
27 $this->addTestFiles( $matchingFiles );
28 } elseif ( file_exists( $path ) ) {
29 // Add a single test case or suite class
30 $this->addTestFile( $path );
31 }
32 }
33 if ( !$paths ) {
34 $this->addTest( new DummyExtensionsTest( 'testNothing' ) );
35 }
36 }
37
38 public static function suite() {
39 return new self;
40 }
41}
42
51 public function testNothing() {
52 $this->assertTrue( true );
53 }
54}
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
Needed to avoid warnings like 'No tests found in class "ExtensionsTestSuite".
testNothing()
@coversNothing
This test suite runs unit tests registered by extensions.