Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 23 |
ValidateRegistrationFile | |
0.00% |
0 / 1 |
|
0.00% |
0 / 2 |
20 | |
0.00% |
0 / 20 |
__construct | |
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 7 |
|||
execute | |
0.00% |
0 / 1 |
12 | |
0.00% |
0 / 13 |
<?php | |
require_once __DIR__ . '/Maintenance.php'; | |
class ValidateRegistrationFile extends Maintenance { | |
public function __construct() { | |
parent::__construct(); | |
$this->addArg( | |
'path', | |
'Path or glob pattern to extension.json/skin.json file.', | |
true | |
); | |
} | |
public function execute() { | |
$validator = new ExtensionJsonValidator( function ( $msg ) { | |
$this->fatalError( $msg ); | |
} ); | |
$validator->checkDependencies(); | |
$paths = glob( $this->getArg( 0 ) ); | |
foreach ( $paths as $path ) { | |
try { | |
$validator->validate( $path ); | |
$this->output( "$path validates against the schema!\n" ); | |
} catch ( ExtensionJsonValidationError $e ) { | |
$this->fatalError( $e->getMessage() ); | |
} | |
} | |
} | |
} | |
$maintClass = ValidateRegistrationFile::class; | |
require_once RUN_MAINTENANCE_IF_MAIN; |