2023-11-25 22:42:07 +01:00
< ? PHP
/**
* Tests for setting uniform place names .
*
* @ author Joshua Ramon Enslin < joshua @ museum - digital . de >
*/
declare ( strict_types = 1 );
use PHPUnit\Framework\TestCase ;
/**
* Tests for setting uniform place names .
*
* @ covers \NodaConsolidatedNamesForPlaces
*/
final class NodaConsolidatedNamesForPlacesTest extends TestCase {
/**
* Test that cleanup function returns expected values .
*
* @ small
*
* @ return void
*/
public function testCleaningNamesWithCanonicalForms () : void {
// Hungarian: u. [0-9] > utca.
self :: assertEquals ( " Test u. 12 " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Test u. 12 " ));
self :: assertEquals ( " Test utca 12 " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Test u. 12 " ));
self :: assertEquals ( " Test u. Test " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Test u. Test " ));
// German: Ending in standard terms that be in brackets
self :: assertEquals ( " Berlin, Insel Borneo " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Berlin, Insel Borneo " ));
self :: assertEquals ( " Berlin (Insel) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Berlin, Insel " ));
self :: assertEquals ( " Berlin, Insel " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Berlin, Insel " ));
// German: Ending in standard terms that be in brackets
self :: assertEquals ( " Adalbrechtstraße 12 " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Adalbrechtstr. 12 " ));
self :: assertEquals ( " Adalbrechtstr. 12 " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Adalbrechtstr. 12 " ));
self :: assertEquals ( " Adalbrechtstraße 12 (Berlin) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Berlin, Adalbrechtstr. 12 " ));
self :: assertEquals ( " Adalbrechtstraße 12 (Berlin) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Adalbrechtstr. 12, Berlin " ));
self :: assertEquals ( " Berlin, Adalbrechtstr. 12 " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Berlin, Adalbrechtstr. 12 " ));
2023-11-26 23:55:22 +01:00
self :: assertEquals ( " Ferenc József rakpart 21. Budapest " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Ferenc József rkp. 21. Budapest " ));
self :: assertEquals ( " Ferenc József rkp. 21. Budapest " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Ferenc József rkp. 21. Budapest " ));
2023-11-25 22:42:07 +01:00
// Same in Hungarian
self :: assertEquals ( " Adalbrecht utca 12 (Berlin) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Berlin, Adalbrecht utca 12 " ));
self :: assertEquals ( " Adalbrecht utca 12 (Berlin) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Adalbrecht utca 12, Berlin " ));
self :: assertEquals ( " Berlin, Adalbrecht utca 12 " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Berlin, Adalbrecht utca 12 " ));
// Deák Ferenc utca 16-18. (Budapest, 5. kerület)
self :: assertEquals ( " Deák Ferenc utca 16-18. (Budapest, 5. kerület) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Deák Ferenc utca 16-18. Budapest, V., " ));
self :: assertEquals ( " Deák Ferenc utca 16-18. (Budapest, 5. kerület) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Deák Ferenc utca 16-18. Budapest, V. " ));
self :: assertEquals ( " Deák Ferenc utca 16-18. Budapest, V. abc " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Deák Ferenc utca 16-18. Budapest, V. abc " ));
// Rewriting country names in brackets
self :: assertEquals ( " Köln (Deutschland) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Deutschland-Köln " ));
self :: assertEquals ( " Köln (Deutschland) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Deutschland, Köln " ));
self :: assertEquals ( " Köln (Deutschland) " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Köln, Deutschland " ));
2023-11-26 23:55:22 +01:00
self :: assertEquals ( " Yue-Öfen " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Yue-Öfen " ));
self :: assertEquals ( " Transkei-Distrikt " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Transkei-Distrikt " ));
self :: assertEquals ( " Ost-Deutschland " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " de " , " Ost-Deutschland " ));
self :: assertEquals ( " Vaci utca 12 Budapest, Vaci utca " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Vaci utca 12 Budapest, Vaci utca " ));
self :: assertEquals ( " Gambia-Tal " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Gambia-Tal " ));
self :: assertEquals ( " Västerdås, Schweden " , NodaConsolidatedNamesForPlaces :: consolidate_name ( " hu " , " Västerdås, Schweden, Schweden " ));
2023-11-25 22:42:07 +01:00
}
}