MediaWiki REL1_32
ExtensionJsonValidationTest.php
Go to the documentation of this file.
1<?php
25class ExtensionJsonValidationTest extends PHPUnit\Framework\TestCase {
26
27 use MediaWikiCoversValidator;
28
32 protected $validator;
33
34 public function setUp() {
35 parent::setUp();
36
37 $this->validator = new ExtensionJsonValidator( [ $this, 'markTestSkipped' ] );
38 $this->validator->checkDependencies();
39
40 if ( !ExtensionRegistry::getInstance()->getAllThings() ) {
41 $this->markTestSkipped(
42 'There are no extensions or skins loaded via the ExtensionRegistry'
43 );
44 }
45 }
46
47 public static function providePassesValidation() {
48 $values = [];
49 foreach ( ExtensionRegistry::getInstance()->getAllThings() as $thing ) {
50 $values[] = [ $thing['path'] ];
51 }
52
53 return $values;
54 }
55
60 public function testPassesValidation( $path ) {
61 try {
62 $this->validator->validate( $path );
63 // All good
64 $this->assertTrue( true );
66 $this->assertEquals( false, $e->getMessage() );
67 }
68 }
69}
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
testPassesValidation( $path)
providePassesValidation
Validate extension.json files against their JSON schema.
returning false will NOT prevent logging $e
Definition hooks.txt:2226