72 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			72 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?PHP
 | |
| /**
 | |
|  * Tests for plausi.
 | |
|  *
 | |
|  * @author Joshua Ramon Enslin <joshua@museum-digital.de>
 | |
|  */
 | |
| declare(strict_types = 1);
 | |
| 
 | |
| use PHPUnit\Framework\TestCase;
 | |
| if (!defined('TL_FILE_DIRS')) {
 | |
|     define('TL_FILE_DIRS', [
 | |
|         __DIR__ . '/../../../l10n/musdb/',
 | |
|         __DIR__ . '/../../../l10n/quality-web/',
 | |
|         __DIR__ . '/../../importer/dependencies/MDAllowedValueSets/l18n/',
 | |
|     ]);
 | |
| }
 | |
| 
 | |
| /**
 | |
|  * 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));
 | |
| 
 | |
| 
 | |
|     }
 | |
| }
 |