2023-09-11 13:42:18 +02:00
< ? PHP
/**
* Tests for plausi .
*
* @ author Joshua Ramon Enslin < joshua @ museum - digital . de >
*/
declare ( strict_types = 1 );
use PHPUnit\Framework\TestCase ;
2023-10-02 14:52:25 +02:00
define ( 'TL_FILE_DIRS' , [
__DIR__ . '/../../../l10n/musdb/' ,
__DIR__ . '/../../../l10n/quality-web/' ,
__DIR__ . '/../../importer/dependencies/MDAllowedValueSets/l18n/' ,
]);
2023-09-11 13:42:18 +02:00
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' ;
2023-09-12 01:12:39 +02:00
# require_once __DIR__ . '/../../MDTlLoader/src/MDTlLoader.php';
2023-09-11 13:42:18 +02:00
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' ;
2023-10-02 14:52:25 +02:00
require_once __DIR__ . '/../../importer/dependencies/MDTlLoader/src/MDTlLoader.php' ;
2023-09-12 01:12:39 +02:00
2023-09-11 13:42:18 +02:00
/**
* 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 {
2023-10-02 14:52:25 +02:00
$tlLoader = new MDTlLoader ( " plausi_test " , " en " );
2023-09-11 13:42:18 +02:00
$plausiEvent = new MDPlausiEvent ( 1 ,
" 1912 " ,
" 1912 " ,
" 1912 " ,
" Helmut Meyer " ,
" 1859 " ,
" 1900 " );
$plausi = new MDPlausi ( $tlLoader , [ $plausiEvent ]);
$plausi -> evaluate ();
self :: assertTrue ( $plausi -> getWarningStatus ());
2023-10-06 23:19:42 +02:00
}
/**
* 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 ));
2023-09-11 13:42:18 +02:00
}
}