diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php
index 8857722fb..ee777b008 100644
--- a/Classes/Controller/AbstractController.php
+++ b/Classes/Controller/AbstractController.php
@@ -615,4 +615,12 @@ protected function getDocumentByUrl(string $documentId)
return $doc;
}
+
+ /**
+ * For testing purposes only.
+ */
+ public function setSettingsForTest($settings)
+ {
+ $this->settings = $settings;
+ }
}
diff --git a/Tests/Fixtures/Controller/documents.csv b/Tests/Fixtures/Controller/documents.csv
new file mode 100644
index 000000000..cc50e80fe
--- /dev/null
+++ b/Tests/Fixtures/Controller/documents.csv
@@ -0,0 +1,10 @@
+tx_dlf_documents,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,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
+,1001,0,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-id4762514197,http://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,,,,,,,,,10 Keyboard pieces - Go. S. 658,10 Keyboard pieces - Go. S. 658,10001,1,0,METS
+,1002,0,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,http://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,,,,,,,,,6 Sacred songs - Go. S. 591,6 Sacred songs - Go. S. 591,10001,1,0,METS
+,1003,0,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,http://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,,,,,,,,3,6 Fugues - Go. S. 317,6 Fugues - Go. S. 317,10001,1,0,METS
+tx_dlf_relations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,ident,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,1201,1001,1,,,,docs_colls,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,1202,1002,1,,,,docs_colls,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,1203,1003,1,,,,docs_colls,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
diff --git a/Tests/Fixtures/Controller/documents.solr.json b/Tests/Fixtures/Controller/documents.solr.json
new file mode 100644
index 000000000..a701dc04b
--- /dev/null
+++ b/Tests/Fixtures/Controller/documents.solr.json
@@ -0,0 +1,93 @@
+[
+ {
+ "id": "1001LOG_0000",
+ "uid": 1001,
+ "page": 1,
+ "thumbnail": "http://example.com/10Kepi_476251419/jpegs/00000003.tif.thumbnail.jpg",
+ "partof": 0,
+ "root": 0,
+ "sid": "LOG_0000",
+ "toplevel": true,
+ "type": "manuscript",
+ "type_faceting": ["manuscript"],
+ "title": "10 Keyboard pieces - Go. S. 658",
+ "record_id": "oai:de:slub-dresden:db:id-476251419",
+ "purl": "http://digital.slub-dresden.de/id476251419",
+ "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml",
+ "urn": "urn:nbn:de:bsz:14-db-id4762514197",
+ "collection": [
+ "test-collection"
+ ],
+ "fulltext": "",
+ "title_usi": ["10 Keyboard pieces - Go. S. 658"],
+ "title_sorting": "10 Keyboard pieces - Go. S. 658",
+ "place_usi": ["[S.l.]"],
+ "year_usi": ["[1759-1800]"],
+ "type_usi": ["manuscript"],
+ "owner_usi": ["default"],
+ "serial_usi": [""],
+ "serial_sorting": "",
+ "useandreproduction_usi": ["CC BY-SA 4.0"],
+ "shelfmark_usi": ["Go. S. 658"],
+ "shelfmark_sorting": "Go. S. 658",
+ "volume": "",
+ "timestamp": "2021-12-03T09:42:55.867Z"
+ },
+ {
+ "id": "1001LOG_0001",
+ "uid": 1001,
+ "page": 1,
+ "thumbnail": "http://example.com/10Kepi_476251419/jpegs/00000001.tif.thumbnail.jpg",
+ "partof": 0,
+ "root": 0,
+ "sid": "LOG_0001",
+ "toplevel": false,
+ "type": "other",
+ "type_faceting": ["other"],
+ "title": "Beigefügte Quellenbeschreibung",
+ "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml",
+ "collection": [
+ "test-collection"
+ ],
+ "fulltext": "",
+ "title_usi": ["Beigefügte Quellenbeschreibung"],
+ "title_sorting": "Beigefügte Quellenbeschreibung",
+ "type_usi": ["other"],
+ "owner_usi": ["SLUB Dresden"],
+ "serial_usi": [""],
+ "serial_sorting": "",
+ "purl": "",
+ "urn": "",
+ "volume": "",
+ "record_id": "",
+ "timestamp": "2021-12-03T09:42:55.960Z"
+ },
+ {
+ "id": "1001LOG_0002",
+ "uid": 1001,
+ "page": 1,
+ "thumbnail": "http://example.com/10Kepi_476251419/jpegs/00000002.tif.thumbnail.jpg",
+ "partof": 0,
+ "root": 0,
+ "sid": "LOG_0002",
+ "toplevel": false,
+ "type": "other",
+ "type_faceting": ["other"],
+ "title": "Beigefügtes Inhaltsverzeichnis",
+ "location": "https://digital.slub-dresden.de/data/kitodo/10Kepi_476251419/10Kepi_476251419_mets.xml",
+ "collection": [],
+ "fulltext": "",
+ "title_usi": ["Beigefügtes Inhaltsverzeichnis"],
+ "title_sorting": "Beigefügtes Inhaltsverzeichnis",
+ "type_usi": ["other"],
+ "owner_usi": ["SLUB Dresden"],
+ "serial_usi": [""],
+ "serial_sorting": "",
+ "purl": "",
+ "urn": "",
+ "volume": "",
+ "record_id": "",
+ "timestamp": "2021-12-03T09:42:55.967Z"
+ }
+]
+
diff --git a/Tests/Fixtures/Controller/documents_calendar.csv b/Tests/Fixtures/Controller/documents_calendar.csv
new file mode 100644
index 000000000..3075f051c
--- /dev/null
+++ b/Tests/Fixtures/Controller/documents_calendar.csv
@@ -0,0 +1,10 @@
+tx_dlf_documents,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,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
+,2001,0,1631775000,1631775000,2,0,0,0,0,,,http://web:8001/Tests/Fixtures/Controller/mets_newspaper_issues.xml,oai:de:slub-dresden:db:id-476251419,476251419,476251419,urn:nbn:de:bsz:14-db-id4762514197,http://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,,,,,,,,,10 Keyboard pieces - Go. S. 658,10 Keyboard pieces - Go. S. 658,10001,1,0,METS
+,2002,0,1631774000,1631774000,2,0,0,0,0,,,http://web:8001/Tests/Fixtures/Controller/mets_newspaper.xml,,476248086,476248086,,,Newspaper for testing purposes,Newspaper for testing purposes,,[1840-1860],[S.l.],https://digital.slub-dresden.de/data/kitodo/6Saso_476248086/6Saso_476248086_tif/jpegs/00000001.tif.thumbnail.jpg,59,0,,,,,,,,,6 Sacred songs - Go. S. 591,6 Sacred songs - Go. S. 591,10001,1,0,METS
+,2003,0,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,http://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,,,,,,,,3,6 Fugues - Go. S. 317,6 Fugues - Go. S. 317,10001,1,0,METS
+tx_dlf_relations,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,uid_local,uid_foreign,tablenames,sorting,sorting_foreign,ident,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,2201,2001,1,,,,docs_colls,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,2202,2002,1,,,,docs_colls,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,2203,2003,1,,,,docs_colls,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
diff --git a/Tests/Fixtures/Controller/documents_local.csv b/Tests/Fixtures/Controller/documents_local.csv
new file mode 100644
index 000000000..463c17f0e
--- /dev/null
+++ b/Tests/Fixtures/Controller/documents_local.csv
@@ -0,0 +1,10 @@
+"tx_dlf_documents",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"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"
+,2001,0,1631775000,1631775000,2,0,0,0,0,,,http://web:8001/Tests/Fixtures/Controller/mets_audio.xml,"oai:de:slub-dresden:db:id-476251419","476251419","476251419","urn:nbn:de:bsz:14-db-id476251419","http://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,,,,,,,,,"10 Keyboard pieces - Go. S. 658","10 Keyboard pieces - Go. S. 658",10001,1,0,"METS"
+,2002,0,1631774000,1631774000,2,0,0,0,0,,,http://web:8001/Tests/Fixtures/Controller/mets_toolbox.xml,"oai:de:slub-dresden:db:id-476248086","476248086","476248086","urn:nbn:de:bsz:14-db-id4762480864","http://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,,,,,,,,,"6 Sacred songs - Go. S. 591","6 Sacred songs - Go. S. 591",10001,1,0,"METS"
+,2003,0,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","http://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,,,,,,,,3,"6 Fugues - Go. S. 317","6 Fugues - Go. S. 317",10001,1,0,"METS"
+"tx_dlf_relations",,,,,,,,,
+,"uid","uid_local","uid_foreign","tablenames","sorting","sorting_foreign","ident"
+,2201,2001,1,,,,"docs_colls"
+,2202,2002,1,,,,"docs_colls"
+,2203,2003,1,,,,"docs_colls"
\ No newline at end of file
diff --git a/Tests/Fixtures/Controller/metadata.csv b/Tests/Fixtures/Controller/metadata.csv
new file mode 100644
index 000000000..508f4785b
--- /dev/null
+++ b/Tests/Fixtures/Controller/metadata.csv
@@ -0,0 +1,12 @@
+tx_dlf_metadata,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,pid,tstamp,crdate,cruser_id,deleted,sys_language_uid,l18n_parent,l18n_diffsource,hidden,sorting,label,index_name,format,default_value,wrap,index_tokenized,index_stored,index_boost,is_sortable,is_facet,is_listed,index_autocomplete,status
+,5001,2,1638557803,1631532810,1,0,0,0,,0,32,Titel,title,1,,,0,1,1,1,0,1,1,0
+,5002,2,1638557803,1631532810,1,0,0,0,,0,32,Sammlungen,collection,1,,,1,0,1,0,1,0,1,0
+tx_dlf_metadataformat,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,pid,tstamp,crdate,cruser_id,deleted,parent_id,encoded,xpath,xpath_sorting,mandatory,,,,,,,,,,,,,
+,5101,2,1638557803,1631532810,1,0,5001,5202,"concat(./mods:titleInfo/mods:nonSort,"" "",./mods:titleInfo/mods:title)",./mods:titleInfo/mods:title,0,,,,,,,,,,,,,
+,5102,2,1638557803,1631532810,1,0,5002,5202,"./mods:relatedItem[@type=""series""]/mods:titleInfo/mods:title[@lang=""ger""]",,0,,,,,,,,,,,,,
+tx_dlf_formats,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,pid,tstamp,crdate,cruser_id,deleted,type,root,namespace,class,,,,,,,,,,,,,,
+,5201,0,1638557803,1631532810,1,0,ALTO,alto,http://www.loc.gov/standards/alto/ns-v2#,Kitodo\Dlf\Format\Alto,,,,,,,,,,,,,,
+,5202,0,1638557803,1631532810,1,0,MODS,mods,http://www.loc.gov/mods/v3,Kitodo\Dlf\Format\Mods,,,,,,,,,,,,,,
diff --git a/Tests/Fixtures/Controller/mets_audio.xml b/Tests/Fixtures/Controller/mets_audio.xml
new file mode 100644
index 000000000..59b84c36b
--- /dev/null
+++ b/Tests/Fixtures/Controller/mets_audio.xml
@@ -0,0 +1,135 @@
+
+
+
+
+ Kitodo - kitodo-ugh-2.1.3-kitodo-ugh-2.1.1-11-g4b06eaa - 30−July−2019
+
+ Kitodo
+
+
+
+
+
+
+
+ Kitodo.Presentation Repository
+ 1234
+
+
+ 123456789
+
+ 123456789
+
+ Document with audio for testing purposes
+
+
+
+ Presentation Repository
+
+ [1759-1800]
+ 1800
+
+
+
+
+
+
+
+
+
+
+ Table of contents
+
+
+
+
+
+
+
+
+
+
+ Audio part
+
+
+
+
+
+
+
+
+
+
+ 24,5 x 33 cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/Fixtures/Controller/mets_newspaper.xml b/Tests/Fixtures/Controller/mets_newspaper.xml
new file mode 100644
index 000000000..c1d50dec1
--- /dev/null
+++ b/Tests/Fixtures/Controller/mets_newspaper.xml
@@ -0,0 +1,125 @@
+
+
+
+
+ Kitodo - kitodo-ugh-2.1.3-kitodo-ugh-2.1.1-11-g4b06eaa - 30−July−2019
+
+ Kitodo
+
+
+
+
+
+
+
+ Kitodo.Presentation Repository
+ 1234
+
+
+ 123456789
+
+ 123456789
+
+ Newspaper for testing purposes
+
+
+
+ Presentation Repository
+
+ [1759-1800]
+ 1800
+
+
+
+
+
+
+
+
+
+
+ Table of contents
+
+
+
+
+
+
+
+
+
+
+ 24,5 x 33 cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/Fixtures/Controller/mets_newspaper_issues.xml b/Tests/Fixtures/Controller/mets_newspaper_issues.xml
new file mode 100644
index 000000000..0dc419cb1
--- /dev/null
+++ b/Tests/Fixtures/Controller/mets_newspaper_issues.xml
@@ -0,0 +1,139 @@
+
+
+
+
+ Kitodo - kitodo-ugh-2.1.3-kitodo-ugh-2.1.1-11-g4b06eaa - 30−July−2019
+
+ Kitodo
+
+
+
+
+
+
+
+ Kitodo.Presentation Repository
+ 1234
+
+
+ 123456789
+
+ 123456789
+
+ Newspaper for testing purposes
+
+
+
+ Presentation Repository
+
+ [1759-1800]
+ 1800
+
+
+
+
+
+
+
+
+
+
+ Table of contents
+
+
+
+
+
+
+
+
+
+
+ 24,5 x 33 cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/Fixtures/Controller/mets_toolbox.xml b/Tests/Fixtures/Controller/mets_toolbox.xml
new file mode 100644
index 000000000..8ec572a5d
--- /dev/null
+++ b/Tests/Fixtures/Controller/mets_toolbox.xml
@@ -0,0 +1,145 @@
+
+
+
+
+ Kitodo - kitodo-ugh-2.1.3-kitodo-ugh-2.1.1-11-g4b06eaa - 30−July−2019
+
+ Kitodo
+
+
+
+
+
+
+
+ Kitodo.Presentation Repository
+ 1234
+
+
+ 123456789
+
+ 123456789
+
+ Document with audio for testing purposes
+
+
+
+ Presentation Repository
+
+ [1759-1800]
+ 1800
+
+
+
+
+
+
+
+
+
+
+ Table of contents
+
+
+
+
+
+
+
+
+
+
+ Audio part
+
+
+
+
+
+
+
+
+
+
+ 24,5 x 33 cm
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Tests/Fixtures/Controller/pages.csv b/Tests/Fixtures/Controller/pages.csv
new file mode 100644
index 000000000..180694c01
--- /dev/null
+++ b/Tests/Fixtures/Controller/pages.csv
@@ -0,0 +1,82 @@
+"pages",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","pid","tstamp","crdate","cruser_id","deleted","hidden","starttime","endtime","fe_group","sorting","rowDescription","editlock","sys_language_uid","l10n_parent","l10n_source","t3_origuid","l10n_diffsource","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","perms_userid","perms_groupid","perms_user","perms_group","perms_everybody","title","slug","doktype","TSconfig","is_siteroot","php_tree_stop","url","shortcut","shortcut_mode","subtitle","layout","target","media","lastUpdated","keywords","cache_timeout","cache_tags","newUntil","description","no_search","SYS_LASTCHANGED","abstract","module","extendToSubpages","author","author_email","nav_title","nav_hide","content_from_pid","mount_pid","mount_pid_ol","l18n_cfg","fe_login_mode","backend_layout","backend_layout_next_level","tsconfig_includes","categories"
+,1,0,1678381239,1678381239,2,0,1,0,0,0,256,,0,0,0,0,0,,0,0,0,0,2,0,31,27,0,Testseite,,1,,0,0,,0,0,,0,,0,0,,0,,0,,0,0,,,0,,,,0,0,0,0,0,0,,,,0
+,2,1,1678700400,1678700400,2,0,1,0,0,,128,,0,0,0,0,0,,0,0,0,0,2,0,31,27,0,"dlf","/",254,,0,0,,0,0,,0,,0,0,,0,,0,,0,0,,,0,,,,0,0,0,0,0,0,,,,0
+"sys_template",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,""
+,"uid","pid","tstamp","crdate","cruser_id","deleted","hidden","starttime","endtime","sorting","description","t3_origuid","t3ver_oid","t3ver_wsid","t3ver_state","title","root","clear","include_static_file","constants","config","basedOn","includeStaticAfterBasedOn","static_file_mode"
+,1,1,1678881727,1678881663,2,0,0,0,0,256,,0,0,0,0,"NEW SITE",1,3,"EXT:fluid_styled_content/Configuration/TypoScript/,EXT:dlf/Configuration/TypoScript/","plugin.tx_dlf.persistence.storagePid = 2",,,0,0
+"tt_content",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"uid","rowDescription","pid","tstamp","crdate","cruser_id","deleted","hidden","starttime","endtime","fe_group","sorting","editlock","sys_language_uid","l18n_parent","l10n_source","t3_origuid","l18n_diffsource","t3ver_oid","t3ver_wsid","t3ver_state","t3ver_stage","CType","header","header_position","bodytext","bullets_type","uploads_description","uploads_type","assets","image","imagewidth","imageorient","imagecols","imageborder","media","layout","frame_class","cols","space_before_class","space_after_class","records","pages","colPos","subheader","header_link","image_zoom","header_layout","list_type","sectionIndex","linkToTop","file_collections","filelink_size","filelink_sorting","filelink_sorting_direction","target","date","recursive","imageheight","pi_flexform","accessibility_title","accessibility_bypass","accessibility_bypass_text","selected_categories","category_field","table_class","table_caption","table_delimiter","table_enclosure","table_header_position","table_tfoot","categories"
+,1,,1,1678700622,1678700488,2,0,0,0,0,,256,0,0,0,0,0,"a:23:{s:5:"CType";N;s:6:"colPos";N;s:6:"header";N;s:13:"header_layout";N;s:15:"header_position";N;s:4:"date";N;s:11:"header_link";N;s:9:"subheader";N;s:9:"list_type";N;s:11:"pi_flexform";N;s:11:"frame_class";N;s:18:"space_before_class";N;s:17:"space_after_class";N;s:12:"sectionIndex";N;s:9:"linkToTop";N;s:16:"sys_language_uid";N;s:6:"hidden";N;s:9:"starttime";N;s:7:"endtime";N;s:8:"fe_group";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;}",0,0,0,0,list,,,,0,0,0,0,0,0,0,2,0,0,0,default,0,,,,,0,,,0,0,dlf_collection,1,0,,0,,,,0,0,0,"
+
+
+
+
+
+ 1
+
+
+ 4
+
+
+ -1
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]]>",,0,,,,,,124,0,0,0,0
+,2,,1,1678700622,1678700488,2,0,0,0,0,,256,0,0,0,0,0,"a:23:{s:5:"CType";N;s:6:"colPos";N;s:6:"header";N;s:13:"header_layout";N;s:15:"header_position";N;s:4:"date";N;s:11:"header_link";N;s:9:"subheader";N;s:9:"list_type";N;s:11:"pi_flexform";N;s:11:"frame_class";N;s:18:"space_before_class";N;s:17:"space_after_class";N;s:12:"sectionIndex";N;s:9:"linkToTop";N;s:16:"sys_language_uid";N;s:6:"hidden";N;s:9:"starttime";N;s:7:"endtime";N;s:8:"fe_group";N;s:8:"editlock";N;s:10:"categories";N;s:14:"rowDescription";N;}"",0,0,0,0,0,"list",0,0,0,0,list,,,,0,0,0,0,0,0,0,2,0,0,0,default,0,,,,,0,,,0,0,dlf_calendar,1,0,,0,,,,0,0,0,"
+
+
+
+
+
+ 1
+
+
+ 4
+
+
+ -1
+
+
+ 0
+
+
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ]]>",,0,,,,,,124,0,0,0,0
+"tx_dlf_collections",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,"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"
+,1,0,1678700538,1678700538,2,0,0,0,"a:16:{s:16:"sys_language_uid";N;s:11:"l18n_parent";N;s:6:"hidden";N;s:8:"fe_group";N;s:5:"label";N;s:10:"index_name";N;s:12:"index_search";N;s:8:"oai_name";N;s:11:"description";N;s:8:"priority";N;s:9:"documents";N;s:5:"owner";N;s:12:"fe_cruser_id";N;s:13:"fe_admin_lock";N;s:6:"status";N;s:9:"thumbnail";N;}"",0,,0,0,"Test Collection",0,,0,0,Test Collection,test-collection,,test-collection,,,3,0,0,0
\ No newline at end of file
diff --git a/Tests/Fixtures/Controller/solrcores.csv b/Tests/Fixtures/Controller/solrcores.csv
new file mode 100644
index 000000000..a2c055c4e
--- /dev/null
+++ b/Tests/Fixtures/Controller/solrcores.csv
@@ -0,0 +1,3 @@
+tx_dlf_solrcores,,,,,,,,
+,uid,pid,tstamp,crdate,cruser_id,deleted,label,index_name
+,4,0,1631254345,1631186030,1,0,Controller Solr Testing Core,
diff --git a/Tests/Functional/Api/OaiPmhTest.php b/Tests/Functional/Api/OaiPmhTest.php
index 1295d5f01..2412ee1a4 100644
--- a/Tests/Functional/Api/OaiPmhTest.php
+++ b/Tests/Functional/Api/OaiPmhTest.php
@@ -72,7 +72,7 @@ protected function setUpOaiSolr()
static $solr = null;
if ($solr === null) {
- $coreName = Solr::createCore();
+ $coreName = Solr::createCore('OaiCore');
$solr = Solr::getInstance($coreName);
$this->importSolrDocuments($solr, __DIR__ . '/../../Fixtures/Common/documents_1.solr.json');
diff --git a/Tests/Functional/Common/SolrSearchQueryTest.php b/Tests/Functional/Common/SolrSearchQueryTest.php
index 909f500ee..3c9bb135b 100644
--- a/Tests/Functional/Common/SolrSearchQueryTest.php
+++ b/Tests/Functional/Common/SolrSearchQueryTest.php
@@ -72,15 +72,10 @@ protected function setUpSolr($uid, $storagePid, $solrFixtures)
{
$this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid);
- // Setup Solr only once for all tests in this suite
- static $solr = null;
-
- if ($solr === null) {
- $coreName = Solr::createCore();
- $solr = Solr::getInstance($coreName);
- foreach ($solrFixtures as $filePath) {
- $this->importSolrDocuments($solr, $filePath);
- }
+ $coreName = Solr::createCore('solrSearchQueryTest');
+ $solr = Solr::getInstance($coreName);
+ foreach ($solrFixtures as $filePath) {
+ $this->importSolrDocuments($solr, $filePath);
}
$coreModel = $this->solrCoreRepository->findByUid($uid);
diff --git a/Tests/Functional/Common/SolrSearchTest.php b/Tests/Functional/Common/SolrSearchTest.php
index 2143e7a32..dc03969bf 100644
--- a/Tests/Functional/Common/SolrSearchTest.php
+++ b/Tests/Functional/Common/SolrSearchTest.php
@@ -84,15 +84,10 @@ protected function setUpSolr($uid, $storagePid, $solrFixtures)
{
$this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid);
- // Setup Solr only once for all tests in this suite
- static $solr = null;
-
- if ($solr === null) {
- $coreName = Solr::createCore();
- $solr = Solr::getInstance($coreName);
- foreach ($solrFixtures as $filePath) {
- $this->importSolrDocuments($solr, $filePath);
- }
+ $coreName = Solr::createCore('solrSearchTest');
+ $solr = Solr::getInstance($coreName);
+ foreach ($solrFixtures as $filePath) {
+ $this->importSolrDocuments($solr, $filePath);
}
$coreModel = $this->solrCoreRepository->findByUid($uid);
diff --git a/Tests/Functional/Common/SolrTest.php b/Tests/Functional/Common/SolrTest.php
index 212df87b5..ab6f55304 100644
--- a/Tests/Functional/Common/SolrTest.php
+++ b/Tests/Functional/Common/SolrTest.php
@@ -65,10 +65,10 @@ public function canEscapeQueryKeepField()
*/
public function canGetNextCoreNumber()
{
- $this->assertEquals(5, Solr::getNextCoreNumber());
- $this->assertEquals(5, Solr::getNextCoreNumber());
+ $this->assertEquals(2, Solr::getNextCoreNumber());
+ $this->assertEquals(2, Solr::getNextCoreNumber());
Solr::createCore();
- $this->assertEquals(6, Solr::getNextCoreNumber());
+ $this->assertEquals(3, Solr::getNextCoreNumber());
}
/**
@@ -96,15 +96,10 @@ protected function setUpSolr($uid, $storagePid, $solrFixtures)
{
$solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid);
- // Setup Solr only once for all tests in this suite
- static $solr = null;
-
- if ($solr === null) {
- $coreName = Solr::createCore();
- $solr = Solr::getInstance($coreName);
- foreach ($solrFixtures as $filePath) {
- $this->importSolrDocuments($solr, $filePath);
- }
+ $coreName = Solr::createCore('SolrTestCore');
+ $solr = Solr::getInstance($coreName);
+ foreach ($solrFixtures as $filePath) {
+ $this->importSolrDocuments($solr, $filePath);
}
$coreModel = $solrCoreRepository->findByUid($uid);
diff --git a/Tests/Functional/Controller/AbstractControllerTest.php b/Tests/Functional/Controller/AbstractControllerTest.php
new file mode 100644
index 000000000..6e40700f4
--- /dev/null
+++ b/Tests/Functional/Controller/AbstractControllerTest.php
@@ -0,0 +1,95 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Common\Solr\Solr;
+use Kitodo\Dlf\Controller\AbstractController;
+use Kitodo\Dlf\Domain\Model\SolrCore;
+use Kitodo\Dlf\Domain\Repository\DocumentRepository;
+use Kitodo\Dlf\Domain\Repository\SolrCoreRepository;
+use Kitodo\Dlf\Tests\Functional\FunctionalTestCase;
+use TYPO3\CMS\Extbase\Mvc\Request;
+use TYPO3\CMS\Extbase\Mvc\View\GenericViewResolver;
+use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+use TYPO3\CMS\Core\Utility\GeneralUtility;
+
+abstract class AbstractControllerTest extends FunctionalTestCase
+{
+ public $currentSolrUid = 1;
+
+ public $currentCoreName = '';
+
+ protected function setUpData($databaseFixtures): void
+ {
+ foreach ($databaseFixtures as $filePath) {
+ $this->importCSVDataSet($filePath);
+ }
+ $this->persistenceManager = GeneralUtility::makeInstance(PersistenceManager::class);
+ $documentRepository = $this->initializeRepository(DocumentRepository::class, 0);
+
+ $allFixtureDocuments = $documentRepository->findAll();
+ foreach ($allFixtureDocuments as $document) {
+ $document->setSolrCore($this->currentSolrUid);
+ $documentRepository->update($document);
+ }
+ $this->persistenceManager->persistAll();
+ }
+
+ protected function setUpSolr($uid, $storagePid, $solrFixtures, $name = '')
+ {
+ $this->solrCoreRepository = $this->initializeRepository(SolrCoreRepository::class, $storagePid);
+
+ $solr = null;
+
+ if ($solr === null) {
+ $coreName = Solr::createCore();
+ $solr = Solr::getInstance($coreName);
+ foreach ($solrFixtures as $filePath) {
+ $this->importSolrDocuments($solr, $filePath);
+ }
+ }
+
+ $coreModel = new SolrCore();
+ $coreModel->setIndexName($coreName);
+ $coreModel->setLabel($coreName);
+ $this->solrCoreRepository->add($coreModel);
+ $this->persistenceManager->persistAll();
+ $this->currentSolrUid = $coreModel->getUid();
+ $this->currentCoreName = $coreName;
+
+ }
+
+ protected function setUpRequest($actionName, $arguments = []): Request
+ {
+ $request = new Request();
+ $request->setControllerActionName($actionName);
+ $request->setArguments($arguments);
+ return $request;
+ }
+
+ protected function setUpController($class, $settings, $templateHtml = ''): AbstractController
+ {
+ $view = new StandaloneView();
+ $view->setTemplateSource($templateHtml);
+
+ $controller = $this->get($class);
+ $viewResolverMock = $this->getMockBuilder(GenericViewResolver::class)
+ ->disableOriginalConstructor()->getMock();
+ $viewResolverMock->expects(self::once())->method('resolve')->willReturn($view);
+ $controller->injectViewResolver($viewResolverMock);
+ $controller->setSettingsForTest($settings);
+ return $controller;
+ }
+
+}
diff --git a/Tests/Functional/Controller/AudioPlayerControllerTest.php b/Tests/Functional/Controller/AudioPlayerControllerTest.php
new file mode 100644
index 000000000..cdd27184e
--- /dev/null
+++ b/Tests/Functional/Controller/AudioPlayerControllerTest.php
@@ -0,0 +1,48 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\AudioPlayerController;
+use TYPO3\CMS\Core\Http\Response;
+
+class AudioPlayerControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents_local.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2001,
+ ];
+ $templateHtml = 'This template should be returned.';
+ $controller = $this->setUpController(AudioPlayerController::class, [], $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'This template should be returned.';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/CalendarControllerTest.php b/Tests/Functional/Controller/CalendarControllerTest.php
new file mode 100644
index 000000000..95426cab9
--- /dev/null
+++ b/Tests/Functional/Controller/CalendarControllerTest.php
@@ -0,0 +1,110 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\CalendarController;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
+
+class CalendarControllerTest extends AbstractControllerTest
+{
+
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/documents_calendar.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv',
+ __DIR__ . '/../../Fixtures/Controller/metadata.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canCalendarAction()
+ {
+ $settings = ['solrcore' => $this->currentCoreName];
+ $templateHtml = '
+ calendarData:
+
+ [{day.dayValue}:{day.issues.0.text}]x|
+ documentId:{documentId}
+ yearLinkTitle:{yearLinkTitle}
+ parentDocumentId:{parentDocumentId}
+ allYearDocTitle:{allYearDocTitle}
+ ';
+ $controller = $this->setUpController(CalendarController::class, $settings, $templateHtml);
+ $arguments = ['id' => 2001];
+ $request = $this->setUpRequest('calendar', $arguments);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ calendarData:
+ xxx[01:issue 1]x[03:issue 2]x|xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|
+ xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|
+ xx[01:issue 4]xxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|xxxxxxx|
+ documentId:2001
+ yearLinkTitle:Test Newspaper
+ parentDocumentId:1
+ allYearDocTitle:Test Newspaper
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $settings = ["storagePid" => 2];
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'page' => '2',
+ ];
+ $controller = $this->setUpController(CalendarController::class, $settings, '');
+
+ $request = $this->setUpRequest('main');
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request);
+ }
+
+ /**
+ * @test
+ */
+ public function canYearsAction()
+ {
+ $settings = ['solrcore' => $this->currentCoreName];
+ $templateHtml = '
+ documentId: {documentId}
+ allYearDocTitle: {allYearDocTitle}
+ documents: {year.title},
+ ';
+ $controller = $this->setUpController(CalendarController::class, $settings, $templateHtml);
+ $arguments = ['id' => "2002"];
+ $request = $this->setUpRequest('years', $arguments);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ documentId: 2002
+ allYearDocTitle: Newspaper for testing purposes
+ documents: 2021,2022,2023,
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/CollectionControllerTest.php b/Tests/Functional/Controller/CollectionControllerTest.php
new file mode 100644
index 000000000..c6a458c29
--- /dev/null
+++ b/Tests/Functional/Controller/CollectionControllerTest.php
@@ -0,0 +1,117 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\CollectionController;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
+
+class CollectionControllerTest extends AbstractControllerTest
+{
+
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ private static array $solrFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.solr.json'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ $this->setUpSolr(4, 2, self::$solrFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canListAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'collections' => '1',
+ 'dont_show_single' => 'some_value',
+ 'randomize' => ''
+ ];
+ $templateHtml = '{item.collection.indexName}';
+ $controller = $this->setUpController(CollectionController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('list', ['id' => 1]);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'test-collection';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canListActionForwardToShow()
+ {
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'collections' => '1',
+ 'randomize' => ''
+ ];
+ $controller = $this->setUpController(CollectionController::class, $settings);
+ $request = $this->setUpRequest('list', ['id' => 1]);
+
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request);
+ }
+
+ /**
+ * @test
+ */
+ public function canShowAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'collections' => '1',
+ 'dont_show_single' => 'some_value',
+ 'randomize' => '',
+ 'storagePid' => 0
+ ];
+ $templateHtml = '{page.title},';
+
+ $controller = $this->setUpController(CollectionController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('show', ['collection' => '1']);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '10 Keyboard pieces - Go. S. 658,';
+ $this->assertEquals($expected, $actual);
+
+ }
+
+ /**
+ * @test
+ */
+ public function canShowSortedAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'collections' => '1',
+ 'dont_show_single' => 'some_value',
+ 'randomize' => ''
+ ];
+ $controller = $this->setUpController(CollectionController::class, $settings);
+ $request = $this->setUpRequest('showSorted');
+
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request);
+ }
+}
diff --git a/Tests/Functional/Controller/FeedsControllerTest.php b/Tests/Functional/Controller/FeedsControllerTest.php
new file mode 100644
index 000000000..c4890a891
--- /dev/null
+++ b/Tests/Functional/Controller/FeedsControllerTest.php
@@ -0,0 +1,62 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\FeedsController;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Core\Localization\LanguageService;
+
+class FeedsControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $GLOBALS['LANG'] = LanguageService::create('default');
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'collections' => '1',
+ 'limit' => 1
+ ];
+ $templateHtml = '
+ {document.uid} – {document.title}
+ feedMeta:
+ ';
+ $controller = $this->setUpController(FeedsController::class, $settings, $templateHtml);
+ $arguments = [
+ 'collection' => '1'
+ ];
+ $request = $this->setUpRequest('main', $arguments);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ 1003 – NEW: 6 Fugues - Go. S. 317
+ feedMeta:0
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/ListViewControllerTest.php b/Tests/Functional/Controller/ListViewControllerTest.php
new file mode 100644
index 000000000..2448308ab
--- /dev/null
+++ b/Tests/Functional/Controller/ListViewControllerTest.php
@@ -0,0 +1,77 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\ListViewController;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+
+class ListViewControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ static array $solrFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.solr.json'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ $this->setUpSolr(4, 2, self::$solrFixtures);
+ }
+
+ /**
+ * @test
+ * @group action
+ */
+ public function canMainAction(): void
+ {
+ $arguments = [
+ 'searchParameter' => [
+ 'query' => '10 Keyboard pieces',
+ ]
+ ];
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'storagePid' => 2,
+ 'dont_show_single' => 'some_value',
+ 'randomize' => ''
+ ];
+ $templateHtml = '
+
+ uniqueId-length: {viewData.uniqueId}
+ page: {page}
+ double: {viewData.requestData.double}
+ lastSearch.query: {lastSearch.query}
+ numResults: {numResults}
+
+ ';
+ $request = $this->setUpRequest('main', $arguments);
+ $controller = $this->setUpController(ListViewController::class, $settings, $templateHtml);
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ uniqueId-length: 13
+ page: 1
+ double: 0
+ lastSearch.query: 10 Keyboard pieces
+ numResults: 1
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/MetadataControllerTest.php b/Tests/Functional/Controller/MetadataControllerTest.php
new file mode 100644
index 000000000..4ec511a40
--- /dev/null
+++ b/Tests/Functional/Controller/MetadataControllerTest.php
@@ -0,0 +1,56 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\MetadataController;
+use TYPO3\CMS\Core\Http\Response;
+
+class MetadataControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'storagePid' => 0
+ ];
+ $templateHtml = '
+ mets_label:{entry}
+ ';
+ $_POST['tx_dlf'] = ['id' => 1001];
+
+ $controller = $this->setUpController(MetadataController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ mets_label:10 Keyboard pieces - Go. S. 658
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/NavigationControllerTest.php b/Tests/Functional/Controller/NavigationControllerTest.php
new file mode 100644
index 000000000..d477bb23e
--- /dev/null
+++ b/Tests/Functional/Controller/NavigationControllerTest.php
@@ -0,0 +1,78 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\NavigationController;
+use Kitodo\Dlf\Domain\Model\PageSelectForm;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+
+class NavigationControllerTest extends AbstractControllerTest
+{
+
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = ['id' => 1001];
+ $templateHtml = '
+ pageSteps: {pageSteps}
+ numPages: {numPages}
+ pageOptions:{entry},
+ ';
+ $controller = $this->setUpController(NavigationController::class, ['solrcore' => $this->currentCoreName], $templateHtml);
+ $request = $this->setUpRequest('main');
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+ $GLOBALS['TSFE']->fe_user->id = 1;
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ pageSteps: 5
+ numPages: 76
+ pageOptions:[1] - - ,[2] - - ,[3] - 1,[4] - 2,[5] - 3,[6] - 4,[7] - 5,[8] - 6,[9] - 7,[10] - 8,[11] - 9,[12] - 10,[13] - 11,[14] - 12,[15] - 13,[16] - 14,[17] - 15,[18] - 16,[19] - 17,[20] - 18,[21] - 19,[22] - 20,[23] - 21,[24] - 22,[25] - 23,[26] - 24,[27] - 25,[28] - 26,[29] - 27,[30] - 28,[31] - 29,[32] - 30,[33] - 31,[34] - 32,[35] - 33,[36] - 34,[37] - 35,[38] - 36,[39] - 37,[40] - 38,[41] - 39,[42] - 40,[43] - 41,[44] - 42,[45] - 43,[46] - 44,[47] - 45,[48] - 46,[49] - 47,[50] - 48,[51] - 49,[52] - 50,[53] - 51,[54] - 52,[55] - 53,[56] - 54,[57] - 55,[58] - 56,[59] - 57,[60] - 58,[61] - 59,[62] - 60,[63] - 61,[64] - 62,[65] - 63,[66] - 64,[67] - 65,[68] - 66,[69] - 67,[70] - 68,[71] - 69,[72] - 70,[73] - 71,[74] - 72,[75] - 73,[76] - 74,
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canPageSelectAction()
+ {
+ $pageSelectForm = new PageSelectForm();
+ $pageSelectForm->setId(1);
+ $pageSelectForm->setPage(2);
+ $pageSelectForm->setDouble(false);
+
+ $controller = $this->setUpController(NavigationController::class, ['solrcore' => $this->currentCoreName], '');
+ $request = $this->setUpRequest('pageSelect', ['pageSelectForm' => $pageSelectForm]);
+
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request);
+ }
+}
diff --git a/Tests/Functional/Controller/PageGridControllerTest.php b/Tests/Functional/Controller/PageGridControllerTest.php
new file mode 100644
index 000000000..6fd722d3c
--- /dev/null
+++ b/Tests/Functional/Controller/PageGridControllerTest.php
@@ -0,0 +1,58 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\PageGridController;
+use TYPO3\CMS\Core\Http\Response;
+
+class PageGridControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents_local.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = ['id' => 2001];
+ $settings = [];
+ $templateHtml = '
+ pageGridEntries:
+ pageGridEntries[0]:{paginator.paginatedItems.0.pagination}, {paginator.paginatedItems.0.thumbnail}
+ pageGridEntries[1]:{paginator.paginatedItems.1.pagination}, {paginator.paginatedItems.1.thumbnail}
+ docUid:{docUid}
+ ';
+ $controller = $this->setUpController(PageGridController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ pageGridEntries:2
+ pageGridEntries[0]: - , http://example.com/mets_audio/jpegs/00000001.tif.thumbnail.jpg
+ pageGridEntries[1]:1, http://example.com/mets_audio/jpegs/00000002.tif.thumbnail.jpg
+ docUid:2001
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/PageViewControllerTest.php b/Tests/Functional/Controller/PageViewControllerTest.php
new file mode 100644
index 000000000..163849908
--- /dev/null
+++ b/Tests/Functional/Controller/PageViewControllerTest.php
@@ -0,0 +1,68 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\PageViewController;
+use TYPO3\CMS\Core\Http\Response;
+
+class PageViewControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents_local.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2001,
+ 'page' => 2
+ ];
+ $templateHtml = '
+ docId:{docId}
+ page:{page}
+ images:
+ {image.url}
+ {image.mimetype}
+ viewerConfiguration:{viewerConfiguration}
+ ';
+ $controller = $this->setUpController(PageViewController::class, ['solrcore' => $this->currentCoreName], $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ docId:2001
+ page:2
+ images:
+ http://example.com/mets_audio/jpegs/00000002.tif.large.jpg
+ image/jpeg
+ viewerConfiguration:$(document).ready(function() {
+ if (dlfUtils.exists(dlfViewer)) {
+ tx_dlf_viewer = new dlfViewer({"controls":[""],"div":null,"progressElementId":null,"images":[{"url":"http:\/\/example.com\/mets_audio\/jpegs\/00000002.tif.large.jpg","mimetype":"image\/jpeg"}],"fulltexts":[[]],"score":[],"annotationContainers":[[]],"measureCoords":[],"useInternalProxy":0,"verovioAnnotations":[],"currentMeasureId":"","measureIdLinks":[]});
+ }
+ });
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/SearchControllerTest.php b/Tests/Functional/Controller/SearchControllerTest.php
new file mode 100644
index 000000000..f847002dc
--- /dev/null
+++ b/Tests/Functional/Controller/SearchControllerTest.php
@@ -0,0 +1,186 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\SearchController;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Core\Session\UserSession;
+use TYPO3\CMS\Core\Session\UserSessionManager;
+use TYPO3\CMS\Core\Utility\StringUtility;
+use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+
+class SearchControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/documents.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ static array $solrFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.solr.json'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpSolr(4, 0, self::$solrFixtures);
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 1001
+ ];
+ $_POST['tx_dlf_listview'] = [
+ 'searchParameter' => []
+ ];
+ $arguments = [
+ 'searchParameter' => [
+ 'dateFrom' => '1800'
+ ]
+ ];
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'extendedFields' => 'field1,field2,field3',
+ 'extendedSlotCount' => 1
+ ];
+ $templateHtml = '
+ lastSearch:{key}:{searchEntry},
+ currentDocument:{currentDocument.uid}
+ searchFields:{field},
+ ';
+
+ $uniqueSessionId = StringUtility::getUniqueId('test');
+ $currentTime = $GLOBALS['EXEC_TIME'];
+
+ // Main session backend setup
+ $userSession = UserSession::createNonFixated($uniqueSessionId);
+ $userSessionManagerMock = $this->createMock(UserSessionManager::class);
+ $userSessionManagerMock->method('createFromRequestOrAnonymous')->withAnyParameters()->willReturn($userSession);
+ $userSessionManagerMock->method('createAnonymousSession')->withAnyParameters()->willReturn($userSession);
+
+ // new session should be written
+ $sessionRecord = [
+ 'ses_id' => 'newSessionId',
+ 'ses_iplock' => '',
+ 'ses_userid' => 0,
+ 'ses_tstamp' => $currentTime,
+ 'ses_data' => 'a:1:{s:3:"foo";s:3:"bar";}',
+ 'ses_permanent' => 0,
+ ];
+ $userSessionToBePersisted = UserSession::createFromRecord($uniqueSessionId, $sessionRecord, true);
+ $userSessionToBePersisted->set('foo', 'bar');
+
+ $controller = $this->setUpController(SearchController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main', $arguments);
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+ $GLOBALS['TSFE']->fe_user->initializeUserSessionManager($userSessionManagerMock);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ lastSearch:dateFrom:1800,dateTo:NOW,
+ currentDocument:1001
+ searchFields:field1,field2,field3,
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canMakeFacetsMenuArray()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 1001
+ ];
+ $_POST['tx_dlf_listview'] = [
+ 'searchParameter' => []
+ ];
+ $arguments = [
+ 'searchParameter' => [
+ 'title' => '10 Keyboard pieces'
+ ],
+ 'query' => '*'
+ ];
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'storagePid' => 0,
+ 'facets' => 'type',
+ 'facetCollections' => '1'
+ ];
+ $templateHtml = '
+ lastSearch:{key}:{searchEntry},
+ currentDocument:{currentDocument.uid}
+ facetsMenu:
+ {menuEntry.field}
+ {subMenuEntry.title}: {subMenuEntry.queryColumn.0}
+ ';
+
+ $uniqueSessionId = StringUtility::getUniqueId('test');
+ $currentTime = $GLOBALS['EXEC_TIME'];
+
+ // Main session backend setup
+ $userSession = UserSession::createNonFixated($uniqueSessionId);
+ $userSessionManagerMock = $this->createMock(UserSessionManager::class);
+ $userSessionManagerMock->method('createFromRequestOrAnonymous')->withAnyParameters()->willReturn($userSession);
+ $userSessionManagerMock->method('createAnonymousSession')->withAnyParameters()->willReturn($userSession);
+
+ // new session should be written
+ $sessionRecord = [
+ 'ses_id' => 'newSessionId',
+ 'ses_iplock' => '',
+ 'ses_userid' => 0,
+ 'ses_tstamp' => $currentTime,
+ 'ses_data' => 'a:1:{s:3:"foo";s:3:"bar";}',
+ 'ses_permanent' => 0,
+ ];
+ $userSessionToBePersisted = UserSession::createFromRecord($uniqueSessionId, $sessionRecord, true);
+ $userSessionToBePersisted->set('foo', 'bar');
+
+ $controller = $this->setUpController(SearchController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main', $arguments);
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+ $GLOBALS['TSFE']->fe_user->initializeUserSessionManager($userSessionManagerMock);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ lastSearch:title:10 Keyboard pieces,
+ currentDocument:1001
+ facetsMenu:
+ type
+ other: type_faceting:("other") manuscript: type_faceting:("manuscript")
+ ';
+ $this->assertEquals($expected, $actual);
+
+ }
+
+ /**
+ * @test
+ */
+ public function canSearchAction()
+ {
+ $controller = $this->setUpController(SearchController::class, [], '');
+ $request = $this->setUpRequest('search', []);
+
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request);
+ }
+}
diff --git a/Tests/Functional/Controller/StatisticsControllerTest.php b/Tests/Functional/Controller/StatisticsControllerTest.php
new file mode 100644
index 000000000..06df143b3
--- /dev/null
+++ b/Tests/Functional/Controller/StatisticsControllerTest.php
@@ -0,0 +1,56 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\StatisticsController;
+use TYPO3\CMS\Core\Http\Response;
+use TYPO3\CMS\Core\Localization\LanguageService;
+
+class StatisticsControllerTest extends AbstractControllerTest
+{
+
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv',
+ __DIR__ . '/../../Fixtures/Controller/documents.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $GLOBALS['LANG'] = LanguageService::create('default');
+
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'collections' => '1',
+ 'storagePid' => '0',
+ 'description' => 'There are ###TITLES### and ###VOLUMES###.'
+ ];
+ $templateHtml = '{content}';
+
+ $request = $this->setUpRequest('main');
+ $controller = $this->setUpController(StatisticsController::class, $settings, $templateHtml);
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'There are 3 titles and 3 volumes.';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/TableOfContentsControllerTest.php b/Tests/Functional/Controller/TableOfContentsControllerTest.php
new file mode 100644
index 000000000..1b2e02d9f
--- /dev/null
+++ b/Tests/Functional/Controller/TableOfContentsControllerTest.php
@@ -0,0 +1,64 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\TableOfContentsController;
+use TYPO3\CMS\Core\Http\Response;
+
+class TableOfContentsControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = ['id' => 1001];
+ $settings = ['storagePid' => 0];
+ $templateHtml = '
+{entry.type} – {entry.title}
+
+{subentry.type} – {subentry.title}
+
+
+';
+ $controller = $this->setUpController(TableOfContentsController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+manuscript – 10 Keyboard pieces - Go. S. 658
+
+other – Beigefügte Quellenbeschreibung
+
+other – Beigefügtes Inhaltsverzeichnis
+
+other – [Diverse]: 6 Airs Variés et tirés du Journal die Grazienbibliothek 1791. [Klavier]
+
+
+';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/ToolboxControllerTest.php b/Tests/Functional/Controller/ToolboxControllerTest.php
new file mode 100644
index 000000000..a26706fe2
--- /dev/null
+++ b/Tests/Functional/Controller/ToolboxControllerTest.php
@@ -0,0 +1,230 @@
+
+ *
+ * This file is part of the Kitodo and TYPO3 projects.
+ *
+ * @license GNU General Public License version 3 or later.
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ */
+
+namespace Kitodo\Dlf\Tests\Functional\Controller;
+
+use Kitodo\Dlf\Controller\ToolboxController;
+use TYPO3\CMS\Core\Http\Response;
+
+class ToolboxControllerTest extends AbstractControllerTest
+{
+ private static array $databaseFixtures = [
+ __DIR__ . '/../../Fixtures/Controller/documents_local.csv',
+ __DIR__ . '/../../Fixtures/Controller/pages.csv',
+ __DIR__ . '/../../Fixtures/Controller/solrcores.csv'
+ ];
+
+ public function setUp(): void
+ {
+ parent::setUp();
+ $this->setUpData(self::$databaseFixtures);
+ }
+
+ /**
+ * @test
+ */
+ public function canFulltextdownloadtool()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'page' => '2'
+ ];
+ $settings = [
+ 'tools' => 'tx_dlf_fulltextdownloadtool'
+ ];
+ $templateHtml = 'fulltextDownload:{fulltextDownload}';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'fulltextDownload:1';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canFulltexttool()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'page' => '2'
+ ];
+ $settings = [
+ 'tools' => 'tx_dlf_fulltexttool',
+ 'activateFullTextInitially' => 1
+ ];
+ $templateHtml = 'fulltext:{fulltext},activateFullTextInitially:{activateFullTextInitially}';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'fulltext:1,activateFullTextInitially:1';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canImagedownloadtool()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'double' => 1,
+ 'page' => 1
+ ];
+ $settings = [
+ 'tools' => 'tx_dlf_imagedownloadtool',
+ 'fileGrpsImageDownload' => 'MAX'
+ ];
+ $templateHtml = 'imageDownload:
+ {image.url}{image.mimetypeLabel}
+ ';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'imageDownload:
+ http://web:8001/Tests/Fixtures/Controller/mets_local/jpegs/00000001.tif.large.jpg (JPG)
+ http://web:8001/Tests/Fixtures/Controller/mets_local/jpegs/00000002.tif.large.jpg (JPG)
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canImagemanipulationtool()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'page' => '2'
+ ];
+ $settings = [
+ 'tools' => 'tx_dlf_imagemanipulationtool',
+ 'parentContainer' => '.parent-container'
+ ];
+ $templateHtml = 'imageManipulation:{imageManipulation},parentContainer:{parentContainer}';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'imageManipulation:1,parentContainer:.parent-container';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 1001,
+ 'double' => 1
+ ];
+ $settings = [
+ 'solrcore' => $this->currentCoreName,
+ 'library' => 1,
+ 'tools' => 'tx_dlf_annotationtool',
+ 'limit' => 1
+ ];
+ $templateHtml = 'double:{double}';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'double:1';
+ $this->assertEquals($expected, $actual);
+
+ }
+
+ /**
+ * @test
+ */
+ public function canPdfdownloadtool()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'page' => 1,
+ 'double' => 1
+ ];
+ $settings = [
+ 'tools' => 'tx_dlf_pdfdownloadtool'
+ ];
+ $templateHtml = 'pageLinks:
+ {link}
+ workLink:{workLink}
+ ';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = 'pageLinks:
+ http://web:8001/Tests/Fixtures/Controller/mets_local/jpegs/00000001.tif.pdf
+ http://web:8001/Tests/Fixtures/Controller/mets_local/jpegs/00000002.tif.pdf
+ workLink:http://web:8001/Tests/Fixtures/Controller/mets_local/jpegs/00000002.tif.pdf
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canSearchindocumenttool()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 2002,
+ 'page' => 1
+ ];
+ $settings = [
+ 'solrcore' => $this->currentSolrUid,
+ 'tools' => 'tx_dlf_searchindocumenttool',
+ 'queryInputName' => 'queryInputName',
+ 'startInputName' => 'startInputName',
+ 'idInputName' => 'idInputName',
+ 'pageInputName' => 'pageInputName',
+ 'highlightWordInputName' => 'highlightWordInputName',
+ 'encryptedInputName' => 'encryptedInputName',
+ 'documentIdUrlSchema' => 'https://host.de/items/*id*/record',
+ ];
+ $templateHtml = '
+ LABEL_QUERY_URL:{searchInDocument.labelQueryUrl}
+ LABEL_START:{searchInDocument.labelStart}
+ LABEL_ID:{searchInDocument.labelId}
+ LABEL_PAGE_URL:{searchInDocument.labelPageUrl}
+ LABEL_HIGHLIGHT_WORD:{searchInDocument.labelHighlightWord}
+ LABEL_ENCRYPTED:{searchInDocument.labelEncrypted}
+ CURRENT_DOCUMENT:{searchInDocument.documentId}
+ ';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+
+ $response = $controller->processRequest($request);
+ $actual = $response->getBody()->getContents();
+ $expected = '
+ LABEL_QUERY_URL:queryInputName
+ LABEL_START:startInputName
+ LABEL_ID:idInputName
+ LABEL_PAGE_URL:pageInputName
+ LABEL_HIGHLIGHT_WORD:highlightWordInputName
+ LABEL_ENCRYPTED:encryptedInputName
+ CURRENT_DOCUMENT:2002
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/composer.json b/composer.json
index d24ef46f8..453523898 100644
--- a/composer.json
+++ b/composer.json
@@ -43,6 +43,7 @@
"symfony/process": "^5.4|^6.4"
},
"require-dev": {
+ "fluidtypo3/vhs": "^7.0",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "^9.6.20",
"spatie/phpunit-watcher": "^1.23",