Skip to content

Commit 792f733

Browse files
thomaslowoliver-stoehrsebastian-meyer
authored
[MAINTENANCE] Updated tests for Hooks package (merged with Typo3 v13 update) (kitodo#1703)
Co-authored-by: Oliver Stöhr <stoehr@effective-webwork.de> Co-authored-by: Sebastian Meyer <sebastian.meyer@opencultureconsulting.com>
1 parent 771880c commit 792f733

File tree

10 files changed

+1410
-2
lines changed

10 files changed

+1410
-2
lines changed

Classes/Common/Indexer.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,4 +800,14 @@ private static function addMessage(string $message, string $type, ContextualFeed
800800
private function __construct()
801801
{
802802
}
803+
804+
/**
805+
* Reset the array of already processed docs in case a different index is used e.g. during testing.
806+
*
807+
* @return void
808+
*/
809+
public static function resetProcessedDocs(): void
810+
{
811+
self::$processedDocs = [];
812+
}
803813
}

Classes/Hooks/DataHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public function processDatamap_postProcessFieldArray(string $status, string $tab
9292
$fieldArray['label'] = $fieldArray['index_name'];
9393
}
9494
// Ensure that index names don't get mixed up with sorting values.
95-
if (str_ends_with($fieldArray['index_name'], '_sorting')) {
95+
if (!empty($fieldArray['index_name']) && str_ends_with($fieldArray['index_name'], '_sorting')) {
9696
$fieldArray['index_name'] .= '0';
9797
}
9898
break;

Tests/Fixtures/Hooks/documents.csv

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
"tx_dlf_documents",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
2+
,"uid","pid","tstamp","crdate","cruser_id","deleted","hidden","starttime","endtime","fe_group","prod_id","location","record_id","opac_id","union_id","urn","purl","title","title_sorting","author","year","place","thumbnail","structure","partof","volume","volume_sorting","license","terms","restrictions","out_of_print","rights_info","collections","mets_label","mets_orderlabel","owner","solrcore","status","document_format"
3+
,1001,20000,1631775000,1631775000,2,0,0,0,0,,,"https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml","oai:de:slub-dresden:db:id-476251419","476251419","476251419","urn:nbn:de:bsz:14-db-id476251419","https://digital.slub-dresden.de/id476251419","10 Keyboard pieces - Go. S. 658","10 Keyboard pieces - Go. S. 658",,"[1759-1800]","[S.l.]","https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_tif/jpegs/00000003.tif.thumbnail.jpg",59,0,,,,,,,,2,"10 Keyboard pieces - Go. S. 658","10 Keyboard pieces - Go. S. 658",10001,1,0,"METS"
4+
,1002,20000,1631774000,1631774000,2,0,0,0,0,,,"https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_mets.xml","oai:de:slub-dresden:db:id-476248086","476248086","476248086","urn:nbn:de:bsz:14-db-id4762480864","https://digital.slub-dresden.de/id476248086","6 Sacred songs - Go. S. 591","6 Sacred songs - Go. S. 591",,"[1840-1860]","[S.l.]","https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000001.tif.thumbnail.jpg",59,0,,,,,,,,2,"6 Sacred songs - Go. S. 591","6 Sacred songs - Go. S. 591",10001,1,0,"METS"
5+
,1003,20000,1631776000,1631776000,2,0,0,0,0,,,"https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_mets.xml","oai:de:slub-dresden:db:id-476251729","476251729","476251729","urn:nbn:de:bsz:14-db-id4762517292","https://digital.slub-dresden.de/id476251729","6 Fugues - Go. S. 317","6 Fugues - Go. S. 317",,"[um 1820]","[S.l.]","https://digital.slub-dresden.de/data/kitodo/6FuG_476251729/6FuG_476251729_tif/jpegs/00000001.tif.thumbnail.jpg",59,0,,,,,,,,2,"6 Fugues - Go. S. 317","6 Fugues - Go. S. 317",10001,1,0,"METS"
6+
"tx_dlf_collections",,,,,,,,,,,,,,,,,,,,,,,
7+
,"uid","pid","tstamp","crdate","cruser_id","deleted","sys_language_uid","l18n_parent","l18n_diffsource","hidden","fe_group","fe_cruser_id","fe_admin_lock","label","index_name","index_search","oai_name","description","thumbnail","priority","documents","owner","status"
8+
,1101,20000,1631279509,1631279509,2,0,0,0,"a:8:{s:5:"label";N;s:10:"index_name";N;s:8:"oai_name";N;s:11:"description";N;s:9:"documents";N;s:5:"owner";N;s:6:"status";N;s:16:"sys_language_uid";N;}",0,,0,0,"Musik","Musik",,"music",,,3,0,0,0
9+
,1102,20000,1631279509,1631279509,2,0,0,0,"a:8:{s:5:"label";N;s:10:"index_name";N;s:8:"oai_name";N;s:11:"description";N;s:9:"documents";N;s:5:"owner";N;s:6:"status";N;s:16:"sys_language_uid";N;}",0,,0,0,"Collection with single document","collection-with-single-document",,"collection-with-single-document",,,4,0,0,0
10+
"tx_dlf_relations",,,,,,,,,
11+
,"uid","uid_local","uid_foreign","tablenames","sorting","sorting_foreign","ident"
12+
,1201,1001,1101,,,,"docs_colls"
13+
,1202,1002,1101,,,,"docs_colls"
14+
,1203,1003,1101,,,,"docs_colls"
15+
,1204,1001,1102,,,,"docs_colls"

0 commit comments

Comments
 (0)