11<?php
22
33use PKP \tests \PKPTestCase ;
4+ use PKP \doi \Doi ;
45use APP \submission \Submission ;
56use APP \publication \Publication ;
67use APP \author \Author ;
@@ -78,6 +79,10 @@ private function createTestPublication(): void
7879 $ this ->publication ->setData ('authors ' , $ this ->lazyCollectionFromAuthors ($ this ->authors ));
7980 $ this ->publication ->setData ('locale ' , 'pt_BR ' );
8081 $ this ->publication ->setData ('relationStatus ' , '1 ' );
82+
83+ $ doiObject = new Doi ();
84+ $ doiObject ->setData ('doi ' , '10.1234/LepidusPreprints.1245 ' );
85+ $ this ->publication ->setData ('doiObject ' , $ doiObject );
8186 }
8287
8388 private function lazyCollectionFromAuthors (array $ authors ): LazyCollection
@@ -97,7 +102,7 @@ private function addCurrentPublicationToSubmission(): void
97102 $ this ->submission ->setData ('publications ' , array ($ this ->publication ));
98103 }
99104
100- public function testHasDoiAsMarkup (): void
105+ public function testDatasetCitationGetsDoiMarkup (): void
101106 {
102107 $ expectedDOI = 'https://doi.org/10.12345/FK2/NTF9X8 ' ;
103108 $ dataCitation = "Iris Castanheiras, 2021, \"The Rise of The Machine Empire \", $ expectedDOI, Demo Dataverse, V1, UNF:6:dEgtc5Z1MSF3u7c+kF4kXg== [fileUNF] " ;
@@ -115,7 +120,8 @@ public function testHasDoiAsMarkup(): void
115120
116121 public function testPreprintCitationIsApa (): void
117122 {
118- $ expectedSubmissionCitation = 'Castanheiras, I. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus ' ;
123+ $ expectedSubmissionCitation = 'Castanheiras, I. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus. ' ;
124+ $ expectedSubmissionCitation .= ' <a href="https://doi.org/10.1234/LepidusPreprints.1245">https://doi.org/10.1234/LepidusPreprints.1245</a> ' ;
119125
120126 $ apaCitation = new APACitation ();
121127 $ preprintCitation = $ apaCitation ->getFormattedCitationBySubmission ($ this ->submission );
@@ -132,7 +138,9 @@ public function testFamilyNameWithAccentOnTheFirstLetter(): void
132138 $ apaCitation = new APACitation ();
133139 $ preprintCitation = $ apaCitation ->getFormattedCitationBySubmission ($ this ->submission );
134140
135- $ expectedSubmissionCitation = 'Álamo, Á. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus ' ;
141+ $ expectedSubmissionCitation = 'Álamo, Á. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus. ' ;
142+ $ expectedSubmissionCitation .= ' <a href="https://doi.org/10.1234/LepidusPreprints.1245">https://doi.org/10.1234/LepidusPreprints.1245</a> ' ;
143+
136144 $ this ->assertEquals ($ expectedSubmissionCitation , $ preprintCitation );
137145 }
138146
@@ -145,7 +153,9 @@ public function testGivenNameWithAccentAnyLetterExceptFirstLetterAndFamilyNameWi
145153 $ apaCitation = new APACitation ();
146154 $ preprintCitation = $ apaCitation ->getFormattedCitationBySubmission ($ this ->submission );
147155
148- $ expectedSubmissionCitation = 'Fernandes, M. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus ' ;
156+ $ expectedSubmissionCitation = 'Fernandes, M. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus. ' ;
157+ $ expectedSubmissionCitation .= ' <a href="https://doi.org/10.1234/LepidusPreprints.1245">https://doi.org/10.1234/LepidusPreprints.1245</a> ' ;
158+
149159 $ this ->assertEquals ($ expectedSubmissionCitation , $ preprintCitation );
150160 }
151161
@@ -158,7 +168,9 @@ public function testFamilyNameWithAccentOnTheFirstLetterAndGivenNameWithoutAccen
158168 $ apaCitation = new APACitation ();
159169 $ preprintCitation = $ apaCitation ->getFormattedCitationBySubmission ($ this ->submission );
160170
161- $ expectedSubmissionCitation = 'Átila, L. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus ' ;
171+ $ expectedSubmissionCitation = 'Átila, L. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus. ' ;
172+ $ expectedSubmissionCitation .= ' <a href="https://doi.org/10.1234/LepidusPreprints.1245">https://doi.org/10.1234/LepidusPreprints.1245</a> ' ;
173+
162174 $ this ->assertEquals ($ expectedSubmissionCitation , $ preprintCitation );
163175 }
164176
@@ -171,7 +183,9 @@ public function testGivenNameAndFamilyNameWithAccentExceptFirstLetter(): void
171183 $ apaCitation = new APACitation ();
172184 $ preprintCitation = $ apaCitation ->getFormattedCitationBySubmission ($ this ->submission );
173185
174- $ expectedSubmissionCitation = 'Sérgio, C. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus ' ;
186+ $ expectedSubmissionCitation = 'Sérgio, C. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus. ' ;
187+ $ expectedSubmissionCitation .= ' <a href="https://doi.org/10.1234/LepidusPreprints.1245">https://doi.org/10.1234/LepidusPreprints.1245</a> ' ;
188+
175189 $ this ->assertEquals ($ expectedSubmissionCitation , $ preprintCitation );
176190 }
177191
@@ -183,7 +197,9 @@ public function testGivenNameWithAccentOnTheFirstLetter(): void
183197 $ apaCitation = new APACitation ();
184198 $ preprintCitation = $ apaCitation ->getFormattedCitationBySubmission ($ this ->submission );
185199
186- $ expectedSubmissionCitation = 'Castanheiras, Â. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus ' ;
200+ $ expectedSubmissionCitation = 'Castanheiras, Â. (2021). <em>The Rise of The Machine Empire</em>. Preprints da Lepidus. ' ;
201+ $ expectedSubmissionCitation .= ' <a href="https://doi.org/10.1234/LepidusPreprints.1245">https://doi.org/10.1234/LepidusPreprints.1245</a> ' ;
202+
187203 $ this ->assertEquals ($ expectedSubmissionCitation , $ preprintCitation );
188204 }
189205}
0 commit comments