MediaWiki
REL1_31
ExtensionJsonValidationTest.php
Go to the documentation of this file.
1
<?php
23
class
ExtensionJsonValidationTest
extends
PHPUnit\Framework\TestCase {
24
25
use MediaWikiCoversValidator;
26
30
protected
$validator
;
31
32
public
function
setUp
() {
33
parent::setUp();
34
35
$this->validator =
new
ExtensionJsonValidator
( [ $this,
'markTestSkipped'
] );
36
$this->validator->checkDependencies();
37
38
if
( !
ExtensionRegistry::getInstance
()->getAllThings() ) {
39
$this->markTestSkipped(
40
'There are no extensions or skins loaded via the ExtensionRegistry'
41
);
42
}
43
}
44
45
public
static
function
providePassesValidation
() {
46
$values = [];
47
foreach
(
ExtensionRegistry::getInstance
()->getAllThings() as $thing ) {
48
$values[] = [ $thing[
'path'
] ];
49
}
50
51
return
$values;
52
}
53
58
public
function
testPassesValidation
( $path ) {
59
try
{
60
$this->validator->validate( $path );
61
// All good
62
$this->assertTrue(
true
);
63
}
catch
(
ExtensionJsonValidationError
$e
) {
64
$this->assertEquals(
false
,
$e
->getMessage() );
65
}
66
}
67
}
ExtensionJsonValidationError
Definition
ExtensionJsonValidationError.php:21
ExtensionJsonValidationTest
This program is free software; you can redistribute it and/or modify it under the terms of the GNU Ge...
Definition
ExtensionJsonValidationTest.php:23
ExtensionJsonValidationTest\testPassesValidation
testPassesValidation( $path)
providePassesValidation
Definition
ExtensionJsonValidationTest.php:58
ExtensionJsonValidationTest\setUp
setUp()
Definition
ExtensionJsonValidationTest.php:32
ExtensionJsonValidationTest\$validator
ExtensionJsonValidator $validator
Definition
ExtensionJsonValidationTest.php:30
ExtensionJsonValidationTest\providePassesValidation
static providePassesValidation()
Definition
ExtensionJsonValidationTest.php:45
ExtensionJsonValidator
Definition
ExtensionJsonValidator.php:28
ExtensionRegistry\getInstance
static getInstance()
Definition
ExtensionRegistry.php:88
$e
returning false will NOT prevent logging $e
Definition
hooks.txt:2176
tests
phpunit
structure
ExtensionJsonValidationTest.php
Generated on Mon Nov 25 2024 15:36:44 for MediaWiki by
1.10.0