Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 19 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
ValidateRegistrationFile | |
0.00% |
0 / 16 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 10 |
|
0.00% |
0 / 1 |
12 |
1 | <?php |
2 | |
3 | require_once __DIR__ . '/Maintenance.php'; |
4 | |
5 | class ValidateRegistrationFile extends Maintenance { |
6 | public function __construct() { |
7 | parent::__construct(); |
8 | $this->addArg( |
9 | 'path', |
10 | 'Path or glob pattern to extension.json/skin.json file.', |
11 | true |
12 | ); |
13 | } |
14 | |
15 | public function execute() { |
16 | $validator = new ExtensionJsonValidator( function ( $msg ) { |
17 | $this->fatalError( $msg ); |
18 | } ); |
19 | $validator->checkDependencies(); |
20 | $paths = glob( $this->getArg( 0 ) ); |
21 | foreach ( $paths as $path ) { |
22 | try { |
23 | $validator->validate( $path ); |
24 | $this->output( "$path validates against the schema!\n" ); |
25 | } catch ( ExtensionJsonValidationError $e ) { |
26 | $this->fatalError( $e->getMessage() ); |
27 | } |
28 | } |
29 | } |
30 | } |
31 | |
32 | $maintClass = ValidateRegistrationFile::class; |
33 | require_once RUN_MAINTENANCE_IF_MAIN; |