diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php
index a545ed05d..a5982a0dc 100644
--- a/Classes/Controller/AbstractController.php
+++ b/Classes/Controller/AbstractController.php
@@ -424,4 +424,12 @@ protected function buildSimplePagination(PaginationInterface $pagination, Pagina
'pagesG' => $pages
];
}
+
+ /**
+ * 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..ebd8894cf
--- /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"
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..4ddfefed6
--- /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,legacy_overlay_uid,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,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,0
+sys_template,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
+,uid,pid,tstamp,crdate,cruser_id,deleted,hidden,starttime,endtime,sorting,description,t3_origuid,t3ver_oid,t3ver_wsid,t3ver_state,t3ver_count,t3ver_tstamp,t3ver_move_id,title,sitetitle,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,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,t3ver_count,t3ver_tstamp,t3ver_move_id,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,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,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,test-collection,,test-collection,,,3,0,0,0,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
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 01ac83acd..6f916694f 100644
--- a/Tests/Functional/Api/OaiPmhTest.php
+++ b/Tests/Functional/Api/OaiPmhTest.php
@@ -62,7 +62,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 fe145bb32..15cadc61b 100644
--- a/Tests/Functional/Common/SolrSearchQueryTest.php
+++ b/Tests/Functional/Common/SolrSearchQueryTest.php
@@ -73,15 +73,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 4029823f5..b1f6fec19 100644
--- a/Tests/Functional/Common/SolrSearchTest.php
+++ b/Tests/Functional/Common/SolrSearchTest.php
@@ -86,15 +86,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 4a597bcf9..5e5a2e6d8 100644
--- a/Tests/Functional/Common/SolrTest.php
+++ b/Tests/Functional/Common/SolrTest.php
@@ -66,10 +66,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());
}
/**
@@ -98,15 +98,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('SolrTestCore');
+ $solr = Solr::getInstance($coreName);
+ foreach ($solrFixtures as $filePath) {
+ $this->importSolrDocuments($solr, $filePath);
}
$coreModel = $this->solrCoreRepository->findByUid($uid);
diff --git a/Tests/Functional/Controller/AbstractControllerTest.php b/Tests/Functional/Controller/AbstractControllerTest.php
new file mode 100644
index 000000000..87d2b8c5e
--- /dev/null
+++ b/Tests/Functional/Controller/AbstractControllerTest.php
@@ -0,0 +1,100 @@
+
+ *
+ * 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\Response;
+use TYPO3\CMS\Extbase\Mvc\View\GenericViewResolver;
+use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager;
+use TYPO3\CMS\Fluid\View\StandaloneView;
+
+
+abstract class AbstractControllerTest extends FunctionalTestCase
+{
+ public $currentSolrUid = 1;
+
+ public $currentCoreName = '';
+
+ protected function setUpData($databaseFixtures): void
+ {
+ foreach ($databaseFixtures as $filePath) {
+ $this->importCSVDataSet($filePath);
+ }
+ $this->persistenceManager = $this->objectManager->get(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);
+ $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;
+ }
+
+ protected function getResponse(): Response
+ {
+ return $this->objectManager->get(Response::class);
+ }
+
+}
diff --git a/Tests/Functional/Controller/AudioPlayerControllerTest.php b/Tests/Functional/Controller/AudioPlayerControllerTest.php
new file mode 100644
index 000000000..f0e238bcb
--- /dev/null
+++ b/Tests/Functional/Controller/AudioPlayerControllerTest.php
@@ -0,0 +1,49 @@
+
+ *
+ * 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;
+
+class AudioPlayerControllerTest extends AbstractControllerTest
+{
+ 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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+
+ $actual = $response->getContent();
+ $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..f95f834bb
--- /dev/null
+++ b/Tests/Functional/Controller/CalendarControllerTest.php
@@ -0,0 +1,112 @@
+
+ *
+ * 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\Extbase\Mvc\Exception\StopActionException;
+
+class CalendarControllerTest extends AbstractControllerTest
+{
+
+ 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->currentSolrUid];
+ $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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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, '');
+ $response = $this->getResponse();
+
+ $request = $this->setUpRequest('main');
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request, $response);
+ }
+
+ /**
+ * @test
+ */
+ public function canYearsAction()
+ {
+ $settings = ['solrcore' => $this->currentSolrUid];
+ $templateHtml = '
+ documentId: {documentId}
+ allYearDocTitle: {allYearDocTitle}
+ documents: {year.title},
+ ';
+ $controller = $this->setUpController(CalendarController::class, $settings, $templateHtml);
+ $arguments = ['id' => "2002"];
+ $request = $this->setUpRequest('years', $arguments);
+ $response = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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..fae72fafc
--- /dev/null
+++ b/Tests/Functional/Controller/CollectionControllerTest.php
@@ -0,0 +1,119 @@
+
+ *
+ * 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\Extbase\Mvc\Exception\StopActionException;
+
+class CollectionControllerTest extends AbstractControllerTest {
+
+ 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
+ */
+ public function canListAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentSolrUid,
+ 'collections' => '1',
+ 'dont_show_single' => 'some_value',
+ 'randomize' => ''
+ ];
+ $templateHtml = '{item.collection.indexName}';
+ $subject = $this->setUpController(CollectionController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('list', ['id' => 1]);
+ $response = $this->getResponse();
+
+ $subject->processRequest($request, $response);
+
+ $actual = $response->getContent();
+ $expected = 'test-collection';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canListActionForwardToShow()
+ {
+ $settings = [
+ 'solrcore' => $this->currentSolrUid,
+ 'collections' => '1',
+ 'randomize' => ''
+ ];
+ $subject = $this->setUpController(CollectionController::class, $settings);
+ $request = $this->setUpRequest('list', ['id' => 1]);
+ $response = $this->getResponse();
+
+ $this->expectException(StopActionException::class);
+ $subject->processRequest($request, $response);
+ }
+
+ /**
+ * @test
+ */
+ public function canShowAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentSolrUid,
+ 'collections' => '1',
+ 'dont_show_single' => 'some_value',
+ 'randomize' => ''
+ ];
+ $templateHtml = '{page.title},';
+
+ $subject = $this->setUpController(CollectionController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('show', ['collection' => '1']);
+ $response = $this->getResponse();
+
+ $subject->processRequest($request, $response);
+ $actual = $response->getContent();
+ $expected = '10 Keyboard pieces - Go. S. 658,Beigefügte Quellenbeschreibung,Beigefügtes Inhaltsverzeichnis,';
+ $this->assertEquals($expected, $actual);
+
+ }
+
+ /**
+ * @test
+ */
+ public function canShowSortedAction()
+ {
+ $settings = [
+ 'solrcore' => $this->currentSolrUid,
+ 'collections' => '1',
+ 'dont_show_single' => 'some_value',
+ 'randomize' => ''
+ ];
+ $subject = $this->setUpController(CollectionController::class, $settings);
+ $request = $this->setUpRequest('showSorted');
+ $response = $this->getResponse();
+
+ $this->expectException(StopActionException::class);
+ $subject->processRequest($request, $response);
+ }
+}
diff --git a/Tests/Functional/Controller/FeedsControllerTest.php b/Tests/Functional/Controller/FeedsControllerTest.php
new file mode 100644
index 000000000..abf1ff3a5
--- /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\Localization\LanguageService;
+
+class FeedsControllerTest extends AbstractControllerTest
+{
+ 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->currentSolrUid,
+ '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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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..847a46f8e
--- /dev/null
+++ b/Tests/Functional/Controller/ListViewControllerTest.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\ListViewController;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+
+class ListViewControllerTest extends AbstractControllerTest
+{
+ 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->currentSolrUid,
+ '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);
+ $response = $this->getResponse();
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $expected = '
+ uniqueId-length: 13
+ page: 1
+ double: 0
+ widgetPage: 1
+ 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..2ac44aab9
--- /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;
+
+class MetadataControllerTest extends AbstractControllerTest
+{
+ 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->currentSolrUid,
+ 'storagePid' => 0
+ ];
+ $templateHtml = '
+ mets_label:{entry}
+ ';
+ $_POST['tx_dlf'] = ['id' => 1001];
+
+ $controller = $this->setUpController(MetadataController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+ $response = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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..83bb5fd46
--- /dev/null
+++ b/Tests/Functional/Controller/NavigationControllerTest.php
@@ -0,0 +1,79 @@
+
+ *
+ * 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\Extbase\Mvc\Exception\StopActionException;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+
+class NavigationControllerTest extends AbstractControllerTest
+{
+
+ 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->currentSolrUid], $templateHtml);
+ $request = $this->setUpRequest('main');
+ $response = $this->getResponse();
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+ $GLOBALS['TSFE']->fe_user->id = 1;
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $expected = '
+ pageSteps: 0
+ 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->currentSolrUid], '');
+ $request = $this->setUpRequest('pageSelect', ['pageSelectForm' => $pageSelectForm]);
+ $response = $this->getResponse();
+
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request, $response);
+ }
+}
diff --git a/Tests/Functional/Controller/PageGridControllerTest.php b/Tests/Functional/Controller/PageGridControllerTest.php
new file mode 100644
index 000000000..135f8de49
--- /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;
+
+class PageGridControllerTest extends AbstractControllerTest
+{
+ 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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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..a626667d3
--- /dev/null
+++ b/Tests/Functional/Controller/PageViewControllerTest.php
@@ -0,0 +1,76 @@
+
+ *
+ * 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;
+
+class PageViewControllerTest extends AbstractControllerTest
+{
+ 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->currentSolrUid], $templateHtml);
+ $request = $this->setUpRequest('main');
+ $response = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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: "",
+ progressElementId: "",
+ images: [{"url":"http:\/\/example.com\/mets_audio\/jpegs\/00000002.tif.large.jpg","mimetype":"image\/jpeg"}],
+ fulltexts: [[]],
+ annotationContainers: [[]],
+ useInternalProxy: 0
+ });
+ }
+ });
+ ';
+ $this->assertEquals($expected, $actual);
+ }
+}
diff --git a/Tests/Functional/Controller/SearchControllerTest.php b/Tests/Functional/Controller/SearchControllerTest.php
new file mode 100644
index 000000000..c994054cd
--- /dev/null
+++ b/Tests/Functional/Controller/SearchControllerTest.php
@@ -0,0 +1,139 @@
+
+ *
+ * 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\Extbase\Mvc\Exception\StopActionException;
+use TYPO3\CMS\Frontend\Authentication\FrontendUserAuthentication;
+
+class SearchControllerTest extends AbstractControllerTest
+{
+ 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->currentSolrUid,
+ 'extendedFields' => 'field1,field2,field3',
+ 'extendedSlotCount' => 1
+ ];
+ $templateHtml = '
+ lastSearch:{key}:{searchEntry},
+ currentDocument:{currentDocument.uid}
+ searchFields:{field},
+ ';
+ $controller = $this->setUpController(SearchController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main', $arguments);
+ $response = $this->getResponse();
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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->currentSolrUid,
+ 'storagePid' => 0,
+ 'facets' => 'type',
+ 'facetCollections' => '1'
+ ];
+ $templateHtml = '
+ lastSearch:{key}:{searchEntry},
+ currentDocument:{currentDocument.uid}
+ facetsMenu:
+ {menuEntry.field}
+ {subMenuEntry.title}: {subMenuEntry.queryColumn.0}
+ ';
+ $controller = $this->setUpController(SearchController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main', $arguments);
+ $response = $this->getResponse();
+ $GLOBALS['TSFE']->fe_user = new FrontendUserAuthentication();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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', []);
+ $response = $this->getResponse();
+
+ $this->expectException(StopActionException::class);
+ $controller->processRequest($request, $response);
+ }
+}
diff --git a/Tests/Functional/Controller/StatisticsControllerTest.php b/Tests/Functional/Controller/StatisticsControllerTest.php
new file mode 100644
index 000000000..f2efabd66
--- /dev/null
+++ b/Tests/Functional/Controller/StatisticsControllerTest.php
@@ -0,0 +1,55 @@
+
+ *
+ * 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\Localization\LanguageService;
+
+class StatisticsControllerTest extends AbstractControllerTest {
+
+ 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->currentSolrUid,
+ 'collections' => '1',
+ 'storagePid' => '0',
+ 'description' => 'There are ###TITLES### and ###VOLUMES###.'
+ ];
+ $templateHtml = '{content}';
+
+ $request = $this->setUpRequest('main');
+ $response = $this->getResponse();
+ $controller = $this->setUpController(StatisticsController::class, $settings, $templateHtml);
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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..7999d3a9c
--- /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;
+
+class TableOfContentsControllerTest extends AbstractControllerTest
+{
+ 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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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..a8cb5dfc4
--- /dev/null
+++ b/Tests/Functional/Controller/ToolboxControllerTest.php
@@ -0,0 +1,236 @@
+
+ *
+ * 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;
+
+class ToolboxControllerTest extends AbstractControllerTest
+{
+ 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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $expected = 'imageManipulation:1,parentContainer:.parent-container';
+ $this->assertEquals($expected, $actual);
+ }
+
+ /**
+ * @test
+ */
+ public function canMainAction()
+ {
+ $_POST['tx_dlf'] = [
+ 'id' => 1001,
+ 'double' => 1
+ ];
+ $settings = [
+ 'solrcore' => $this->currentSolrUid,
+ 'library' => 1,
+ 'tools' => 'tx_dlf_annotationtool',
+ 'limit' => 1
+ ];
+ $templateHtml = 'double:{double}';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+ $response = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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 = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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/full.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.LABEL_QUERY_URL}
+ LABEL_START:{searchInDocument.LABEL_START}
+ LABEL_ID:{searchInDocument.LABEL_ID}
+ LABEL_PAGE_URL:{searchInDocument.LABEL_PAGE_URL}
+ LABEL_HIGHLIGHT_WORD:{searchInDocument.LABEL_HIGHLIGHT_WORD}
+ LABEL_ENCRYPTED:{searchInDocument.LABEL_ENCRYPTED}
+ CURRENT_DOCUMENT:{searchInDocument.CURRENT_DOCUMENT}
+ ';
+ $controller = $this->setUpController(ToolboxController::class, $settings, $templateHtml);
+ $request = $this->setUpRequest('main');
+ $response = $this->getResponse();
+
+ $controller->processRequest($request, $response);
+ $actual = $response->getContent();
+ $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 3bf0e1bc5..dd41b5620 100644
--- a/composer.json
+++ b/composer.json
@@ -40,6 +40,7 @@
"solarium/solarium": "^5.2.0"
},
"require-dev": {
+ "fluidtypo3/vhs": "^6.1",
"phpstan/phpstan": "^1.10.41",
"spatie/phpunit-watcher": "^1.23.6",
"typo3/cms-backend": "^10.4.37|^11.5.33",