MDQualityAssessment/tests/MDPlausiTest.php

81 lines
2.4 KiB
PHP
Raw Normal View History

<?PHP
/**
* Tests for plausi.
*
* @author Joshua Ramon Enslin <joshua@museum-digital.de>
*/
declare(strict_types = 1);
use PHPUnit\Framework\TestCase;
define('TL_FILE_DIRS', [
__DIR__ . '/../../../l10n/musdb/',
__DIR__ . '/../../../l10n/quality-web/',
__DIR__ . '/../../importer/dependencies/MDAllowedValueSets/l18n/',
]);
require_once __DIR__ . '/../src/Checks/Plausi/MDPlausi.php';
require_once __DIR__ . '/../src/Checks/Plausi/MDEventCategory.php';
require_once __DIR__ . '/../src/Checks/Plausi/MDPlausiEventCategory.php';
require_once __DIR__ . '/../src/Checks/Plausi/MDPlausiEvent.php';
# require_once __DIR__ . '/../../MDTlLoader/src/MDTlLoader.php';
require_once __DIR__ . '/../../importer/dependencies/MDAllowedValueSets/src/MDRequirementsSet.php';
require_once __DIR__ . '/../../importer/dependencies/MDAllowedValueSets/src/MDValueSet.php';
require_once __DIR__ . '/../../importer/dependencies/MDAllowedValueSets/src/MDEventsSet.php';
require_once __DIR__ . '/../../importer/dependencies/MDTlLoader/src/MDTlLoader.php';
/**
* Tests for plausi.
*/
final class MDPlausiTest extends TestCase {
/**
* Ensures that a warning is returned, Checks the integration / evaluation function.
*
* @return void
*/
public function testActorProducingObjectAfterOwnDeathResultsInWarning():void {
$tlLoader = new MDTlLoader("plausi_test", "en");
$plausiEvent = new MDPlausiEvent(1,
"1912",
"1912",
"1912",
"Helmut Meyer",
"1859",
"1900");
$plausi = new MDPlausi($tlLoader, [$plausiEvent]);
$plausi->evaluate();
self::assertTrue($plausi->getWarningStatus());
}
/**
* Ensures that a warning is returned, Checks the integration / evaluation function.
*
* @return void
*/
public function testActorProducingObjectBeforeOwnBirthResultsInWarning():void {
$tlLoader = new MDTlLoader("plausi_test", "en");
$plausiEvent = new MDPlausiEvent(1,
"1812",
"1812",
"1812",
"Helmut Meyer",
"1859",
"1900");
$plausi = new MDPlausi($tlLoader, [$plausiEvent]);
$plausi->evaluate();
self::assertTrue($plausi->getWarningStatus(), "Production before birth of the actor should result in a full warning." . PHP_EOL . PHP_EOL . "Current plausi status is:" . PHP_EOL . var_export($plausi, true));
}
}