Add autoloader for tests, phpunit config
This commit is contained in:
parent
53c645b132
commit
631debcfd8
22
phpunit.xml
Normal file
22
phpunit.xml
Normal file
@ -0,0 +1,22 @@
|
||||
<?xml version="1.0"?>
|
||||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
|
||||
backupGlobals="false" backupStaticAttributes="false"
|
||||
beStrictAboutChangesToGlobalState="true" beStrictAboutOutputDuringTests="false" beStrictAboutResourceUsageDuringSmallTests="true" beStrictAboutTodoAnnotatedTests="true" beStrictAboutCoversAnnotation="false"
|
||||
bootstrap="tests/bootstrap.php"
|
||||
cacheResult="false"
|
||||
colors="true"
|
||||
convertErrorsToExceptions="true" convertDeprecationsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true"
|
||||
enforceTimeLimit="true"
|
||||
failOnWarning="true"
|
||||
forceCoversAnnotation="false"
|
||||
processIsolation="true"
|
||||
stopOnError="true" stopOnFailure="true" stopOnIncomplete="true" stopOnSkipped="true" stopOnRisky="true"
|
||||
testdox="true"
|
||||
timeoutForSmallTests="1" timeoutForMediumTests="10" timeoutForLargeTests="60"
|
||||
verbose="true">
|
||||
<testsuites>
|
||||
<testsuite name="tests">
|
||||
<directory>tests/</directory>
|
||||
</testsuite>
|
||||
</testsuites>
|
||||
</phpunit>
|
@ -6,8 +6,6 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
require_once __DIR__ . "/../src/NodaNameSplitter.php";
|
||||
require_once __DIR__ . "/../../MD_STD/src/MD_STD.php";
|
||||
|
||||
/**
|
||||
* This script contains tests for the actor name splitter.
|
||||
@ -18,6 +16,7 @@ final class NodaNameSplitterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -49,6 +48,7 @@ final class NodaNameSplitterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -6,12 +6,6 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
require __DIR__ . "/../src/NodaTimeSplitter.php";
|
||||
require __DIR__ . "/../src/NodaTimeAutotranslater.php";
|
||||
require __DIR__ . "/../src/enums/NodaTimeAutotranslaterStatus.php";
|
||||
require __DIR__ . "/../src/enums/NodaTimeAutotranslaterSuffixMode.php";
|
||||
require __DIR__ . "/../src/enums/NodaTimeAutotranslaterUseCase.php";
|
||||
require __DIR__ . "/../src/enums/NodaTimeAutotranslaterLocales.php";
|
||||
|
||||
/**
|
||||
* This script contains tests for the automatic translation class for time names.
|
||||
@ -22,6 +16,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -44,6 +39,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -66,6 +62,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -88,6 +85,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -110,6 +108,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -132,6 +131,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -154,6 +154,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -176,6 +177,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -198,6 +200,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -220,6 +223,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -242,6 +246,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -264,6 +269,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -286,6 +292,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -308,6 +315,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -331,6 +339,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -354,6 +363,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -377,6 +387,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -400,6 +411,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -423,6 +435,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -446,6 +459,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -469,6 +483,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -492,6 +507,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -515,6 +531,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -538,6 +555,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -561,6 +579,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -584,6 +603,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -607,6 +627,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -630,6 +651,7 @@ final class NodaTimeAutotranslaterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -6,9 +6,6 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
require_once __DIR__ . "/../src/NodaTimeSplitter.php";
|
||||
require_once __DIR__ . "/../src/NodaTimeAutotranslater.php";
|
||||
require_once __DIR__ . "/../../MD_STD/src/MD_STD.php";
|
||||
|
||||
/**
|
||||
* This script contains tests for the time name splitter.
|
||||
@ -19,6 +16,7 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -433,6 +431,7 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -469,6 +468,7 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -661,6 +661,7 @@ final class NodaTimeSplitterTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
@ -6,7 +6,6 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
require_once __DIR__ . "/../src/NodaUncertaintyHelper.php";
|
||||
|
||||
/**
|
||||
* This script contains tests for the uncertainty helper.
|
||||
@ -15,6 +14,9 @@ final class NodaUncertaintyHelperTest extends TestCase {
|
||||
/**
|
||||
* Removes uncertainty indicators from an time name.
|
||||
*
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCleanUncertaintyIndicatorsTime():void {
|
||||
@ -27,6 +29,9 @@ final class NodaUncertaintyHelperTest extends TestCase {
|
||||
/**
|
||||
* Attempts guessing whether time is uncertain.
|
||||
*
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testGuessTimeCertainty():void {
|
||||
@ -39,6 +44,9 @@ final class NodaUncertaintyHelperTest extends TestCase {
|
||||
/**
|
||||
* Removes uncertainty indicators from an place name.
|
||||
*
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function testCleanUncertaintyIndicatorsPlace():void {
|
||||
@ -51,6 +59,9 @@ final class NodaUncertaintyHelperTest extends TestCase {
|
||||
/**
|
||||
* Attempts guessing whether place is uncertain.
|
||||
*
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function testGuessPlaceCertainty():void {
|
||||
@ -65,6 +76,9 @@ final class NodaUncertaintyHelperTest extends TestCase {
|
||||
/**
|
||||
* Removes uncertainty indicators from an actor name.
|
||||
*
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function testCleanUncertaintyIndicatorsPersinst():void {
|
||||
@ -78,6 +92,9 @@ final class NodaUncertaintyHelperTest extends TestCase {
|
||||
/**
|
||||
* Attempts guessing whether persinst is uncertain.
|
||||
*
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function testGuessPersinstCertainty():void {
|
||||
|
@ -6,8 +6,6 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
require_once __DIR__ . "/../src/NodaValidationHelper.php";
|
||||
require_once __DIR__ . "/../../MDErrorReporter/exceptions/generic/MDgenericInvalidInputsException.php";
|
||||
|
||||
/**
|
||||
* This script contains tests for the validation of single field contents.
|
||||
@ -16,6 +14,8 @@ final class NodaValidationHelperTest extends TestCase {
|
||||
/**
|
||||
* Test successfully refusing too short actor descriptions.
|
||||
*
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testActorDescriptionValidationFailsOnTooShortInput():void {
|
||||
@ -28,6 +28,8 @@ final class NodaValidationHelperTest extends TestCase {
|
||||
/**
|
||||
* Test successfully refusing actor descriptions that have too few distinct characters.
|
||||
*
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testActorDescriptionValidationFailsOnTooFewDistinctCharacters():void {
|
||||
@ -40,6 +42,8 @@ final class NodaValidationHelperTest extends TestCase {
|
||||
/**
|
||||
* Test successfully refusing actor descriptions that simply duplicate the actor name.
|
||||
*
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testActorDescriptionValidationFailsOnDuplicatedActorNames():void {
|
||||
@ -60,6 +64,8 @@ final class NodaValidationHelperTest extends TestCase {
|
||||
/**
|
||||
* Test that a valid description is accepted.
|
||||
*
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testActorDescriptionValidationAcceptsValidDescription():void {
|
||||
|
@ -6,10 +6,6 @@
|
||||
*/
|
||||
declare(strict_types = 1);
|
||||
use PHPUnit\Framework\TestCase;
|
||||
require_once __DIR__ . "/../src/NodaWikidataFetcher.php";
|
||||
require_once __DIR__ . "/../../MDErrorReporter/exceptions/generic/MDExpectedException.php";
|
||||
require_once __DIR__ . "/../../MD_STD/src/MD_STD.php";
|
||||
require_once __DIR__ . "/../../MD_STD/src/MD_STD_IN.php";
|
||||
|
||||
/**
|
||||
* This script contains tests for the Wikidata fetcher.
|
||||
@ -20,6 +16,7 @@ final class NodaWikidataFetcherTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -35,6 +32,7 @@ final class NodaWikidataFetcherTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -49,6 +47,7 @@ final class NodaWikidataFetcherTest extends TestCase {
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
@ -61,6 +60,10 @@ final class NodaWikidataFetcherTest extends TestCase {
|
||||
/**
|
||||
* Test for cleaning wikidata info.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCleanWikidataInput():void {
|
||||
@ -260,6 +263,10 @@ Transclusion expansion time report (%,ms,calls,template)
|
||||
/**
|
||||
* Test for cleaning wikidata info.
|
||||
*
|
||||
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
|
||||
* @group ValidOutput
|
||||
* @small
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testCleanWikidataInputWithoutHtml():void {
|
||||
|
25
tests/bootstrap.php
Normal file
25
tests/bootstrap.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?PHP
|
||||
declare(strict_types = 1);
|
||||
|
||||
/**
|
||||
* Autoloader for musdb.
|
||||
*
|
||||
* @param string $className Name of the class to load.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
\spl_autoload_register(function(string $className):void {
|
||||
|
||||
// Try using class map as defined through /scripts/buildClassMap.php
|
||||
|
||||
foreach (array_merge([__DIR__ . '/../tests', __DIR__ . '/../src', __DIR__ . '/../src/enums', __DIR__ . '/../../MD_STD/src', __DIR__ . '/../../MDErrorReporter', __DIR__ . '/../../MDErrorReporter/exceptions', __DIR__ . '/../../MDErrorReporter/exceptions/generic', __DIR__ . '/../../MDErrorReporter/exceptions/updates']) as $classDir) {
|
||||
|
||||
if (\file_exists("$classDir/$className.php")) {
|
||||
include "$classDir/$className.php";
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user