| 1 |
<?php |
| 2 |
/** |
| 3 |
* Copyright (C) 2011-2020 Wikimedia Foundation and others. |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License along |
| 16 |
* with this program; if not, write to the Free Software Foundation, Inc., |
| 17 |
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 18 |
*/ |
| 19 |
declare( strict_types = 1 ); |
| 20 |
|
| 21 |
namespace MWParsoid; |
| 22 |
|
| 23 |
use MediaWiki\Hook\UnitTestsListHook; |
| 24 |
|
| 25 |
class UnitTestsListHandler implements UnitTestsListHook { |
| 26 |
/** @inheritDoc */ |
| 27 |
public function onUnitTestsList( &$paths ) { |
| 28 |
// Find the directory corresponding to this extension code and skip |
| 29 |
// it! tests/phpunit is our own standalone tests for the Parsoid |
| 30 |
// library. |
| 31 |
$libTestDir = realpath( __DIR__ . '/../../tests/phpunit' ); |
| 32 |
foreach ( $paths as $idx => $path ) { |
| 33 |
if ( realpath( $path ) === $libTestDir ) { |
| 34 |
unset( $paths[$idx] ); |
| 35 |
} |
| 36 |
} |
| 37 |
$paths = array_values( $paths ); // re-index |
| 38 |
// If we need to add extension-specific Parsoid tests |
| 39 |
// we'll put them in extension/tests/phpunit. |
| 40 |
$paths[] = __DIR__ . '/../tests/phpunit'; |
| 41 |
} |
| 42 |
|
| 43 |
} |