3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 * http://www.gnu.org/copyleft/gpl.html
20 * Validates all loaded extensions and skins using the ExtensionRegistry
21 * against the extension.json schema in the docs/ folder.
23 class ExtensionJsonValidationTest
extends PHPUnit_Framework_TestCase
{
26 * @var ExtensionJsonValidator
30 public function setUp() {
33 $this->validator
= new ExtensionJsonValidator( [ $this, 'markTestSkipped' ] );
34 $this->validator
->checkDependencies();
36 if ( !ExtensionRegistry
::getInstance()->getAllThings() ) {
37 $this->markTestSkipped(
38 'There are no extensions or skins loaded via the ExtensionRegistry'
43 public static function providePassesValidation() {
45 foreach ( ExtensionRegistry
::getInstance()->getAllThings() as $thing ) {
46 $values[] = [ $thing['path'] ];
53 * @dataProvider providePassesValidation
54 * @param string $path Path to thing's json file
56 public function testPassesValidation( $path ) {
58 $this->validator
->validate( $path );
60 $this->assertTrue( true );
61 } catch ( ExtensionJsonValidationError
$e ) {
62 $this->assertEquals( false, $e->getMessage() );