@@ -51,7 +51,7 @@ private function createTestSections(): array
5151 return [$ firstSectionId , $ secondSectionId ];
5252 }
5353
54- private function createSubmission ($ dateSubmitted = null , $ dateFinalDecision = null ): int
54+ private function createSubmission ($ dateSubmitted = null , $ finalDecisions = [] ): int
5555 {
5656 $ submissionDao = DAORegistry::getDAO ('SubmissionDAO ' );
5757
@@ -65,27 +65,29 @@ private function createSubmission($dateSubmitted = null, $dateFinalDecision = nu
6565 }
6666 $ submissionId = $ submissionDao ->insertObject ($ submission );
6767
68- if (!is_null ($ dateFinalDecision )) {
69- $ this ->addFinalDecision ($ submissionId , $ dateFinalDecision );
68+ if (!empty ($ finalDecisions )) {
69+ foreach ($ finalDecisions as $ decisionDate => $ decisionType ) {
70+ $ this ->addFinalDecision ($ submissionId , $ decisionDate , $ decisionType );
71+ }
7072 }
7173
7274 return $ submissionId ;
7375 }
7476
7577 private function createTestSubmissions (): array
7678 {
77- $ firstSubmissionId = $ this ->createSubmission ('1921-05-21 11:56:37 ' , '1921-05-24 13:00:00 ' );
78- $ secondSubmissionId = $ this ->createSubmission ('1921-05-29 12:58:29 ' , '1921-06-01 23:41:09 ' );
79- $ thirdSubmissionId = $ this ->createSubmission ('1921-06-14 04:30:08 ' , '1921-06-17 12:00:00 ' );
80- $ fourthSubmissionId = $ this ->createSubmission ('1921-07-08 18:37:12 ' , '1921-07-10 15:49:00 ' );
79+ $ firstSubmissionId = $ this ->createSubmission ('1921-05-21 11:56:37 ' , [ '1921-05-24 13:00:00 ' => SUBMISSION_EDITOR_DECISION_DECLINE ] );
80+ $ secondSubmissionId = $ this ->createSubmission ('1921-05-29 12:58:29 ' , [ '1921-06-01 23:41:09 ' => SUBMISSION_EDITOR_DECISION_DECLINE ] );
81+ $ thirdSubmissionId = $ this ->createSubmission ('1921-06-14 04:30:08 ' , [ '1921-06-17 12:00:00 ' => SUBMISSION_EDITOR_DECISION_DECLINE ] );
82+ $ fourthSubmissionId = $ this ->createSubmission ('1921-07-08 18:37:12 ' , [ '1921-07-10 15:49:00 ' => SUBMISSION_EDITOR_DECISION_DECLINE , ' 1921-11-07 16:00:00 ' => SUBMISSION_EDITOR_DECISION_ACCEPT ] );
8183
8284 return [$ firstSubmissionId , $ secondSubmissionId , $ thirdSubmissionId , $ fourthSubmissionId ];
8385 }
8486
85- private function addFinalDecision ($ submissionId , $ dateDecided )
87+ private function addFinalDecision ($ submissionId , $ decisionDate , $ decisionType )
8688 {
8789 $ editDecisionDao = DAORegistry::getDAO ('EditDecisionDAO ' );
88- $ editDecisionDao ->updateEditorDecision ($ submissionId , ['editDecisionId ' => null , 'decision ' => SUBMISSION_EDITOR_DECISION_DECLINE , 'dateDecided ' => $ dateDecided , 'editorId ' => 1 ]);
90+ $ editDecisionDao ->updateEditorDecision ($ submissionId , ['editDecisionId ' => null , 'decision ' => $ decisionType , 'dateDecided ' => $ decisionDate , 'editorId ' => 1 ]);
8991 }
9092
9193 private function createPublication ($ submissionId , $ sectionId , $ datePublished = null )
@@ -228,14 +230,14 @@ public function testReportFilterByFinalDecisionDate(): void
228230 $ this ->reportFactory = new ScieloSubmissionsReportFactory ($ this ->application , $ this ->contextId , $ this ->sectionsIds , $ this ->submissionDateInterval , $ this ->finalDecisionDateInterval , $ this ->locale , $ this ->includeViews );
229231 $ report = $ this ->reportFactory ->createReport ();
230232
231- $ expectedSubmissions = [$ this ->submissionsIds [2 ], $ this -> submissionsIds [ 3 ] ];
233+ $ expectedSubmissions = [$ this ->submissionsIds [2 ]];
232234 $ scieloSubmissionsIds = $ this ->mapScieloSubmissionsToIds ($ report ->getSubmissions ());
233235 $ this ->assertEquals ($ expectedSubmissions , $ scieloSubmissionsIds );
234236 }
235237
236238 public function testReportFilterByFinalDecisionDateSubmissionAtIntervalStart (): void
237239 {
238- $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-07-10 ' , '1921-07-12 ' );
240+ $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-11-07 ' , '1921-11-09 ' );
239241 $ this ->reportFactory = new ScieloSubmissionsReportFactory ($ this ->application , $ this ->contextId , $ this ->sectionsIds , $ this ->submissionDateInterval , $ this ->finalDecisionDateInterval , $ this ->locale , $ this ->includeViews );
240242 $ report = $ this ->reportFactory ->createReport ();
241243
@@ -246,7 +248,7 @@ public function testReportFilterByFinalDecisionDateSubmissionAtIntervalStart():
246248
247249 public function testReportFilterByFinalDecisionDateSubmissionAtIntervalEnd (): void
248250 {
249- $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-07 -05 ' , '1921-07-10 ' );
251+ $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-11 -05 ' , '1921-11-07 ' );
250252 $ this ->reportFactory = new ScieloSubmissionsReportFactory ($ this ->application , $ this ->contextId , $ this ->sectionsIds , $ this ->submissionDateInterval , $ this ->finalDecisionDateInterval , $ this ->locale , $ this ->includeViews );
251253 $ report = $ this ->reportFactory ->createReport ();
252254
@@ -261,7 +263,7 @@ public function testReportFilterByFinalDecisionDateExcludesSubmissionsWithoutFin
261263 $ publicationId = $ this ->createPublication ($ submissionWithoutFinalDecisionId , $ this ->sectionsIds [0 ]);
262264 $ this ->addCurrentPublicationToSubmission ($ submissionWithoutFinalDecisionId , $ publicationId );
263265
264- $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-05-20 ' , '1921-07 -12 ' );
266+ $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-05-20 ' , '1921-11 -12 ' );
265267 $ this ->reportFactory = new ScieloSubmissionsReportFactory ($ this ->application , $ this ->contextId , $ this ->sectionsIds , $ this ->submissionDateInterval , $ this ->finalDecisionDateInterval , $ this ->locale , $ this ->includeViews );
266268 $ report = $ this ->reportFactory ->createReport ();
267269
@@ -272,7 +274,7 @@ public function testReportFilterByFinalDecisionDateExcludesSubmissionsWithoutFin
272274 public function testReportFilterBySubmissionDateAndFinalDecisionDate (): void
273275 {
274276 $ this ->submissionDateInterval = new ClosedDateInterval ('1921-05-23 ' , '1921-07-01 ' );
275- $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-06-15 ' , '1921-07 -12 ' );
277+ $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-06-15 ' , '1921-11 -12 ' );
276278 $ this ->reportFactory = new ScieloSubmissionsReportFactory ($ this ->application , $ this ->contextId , $ this ->sectionsIds , $ this ->submissionDateInterval , $ this ->finalDecisionDateInterval , $ this ->locale , $ this ->includeViews );
277279 $ report = $ this ->reportFactory ->createReport ();
278280
@@ -289,7 +291,7 @@ public function testReportFilterByFinalDecisionDateInOPSGetsPostedSubmissions():
289291 $ publicationId = $ this ->createPublication ($ postedSubmissionId , $ this ->sectionsIds [0 ], '1921-06-21 14:13:20 ' );
290292 $ this ->addCurrentPublicationToSubmission ($ postedSubmissionId , $ publicationId );
291293
292- $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-05-20 ' , '1921-07 -12 ' );
294+ $ this ->finalDecisionDateInterval = new ClosedDateInterval ('1921-05-20 ' , '1921-11 -12 ' );
293295 $ this ->application = 'ops ' ;
294296 $ this ->reportFactory = new ScieloSubmissionsReportFactory ($ this ->application , $ this ->contextId , $ this ->sectionsIds , $ this ->submissionDateInterval , $ this ->finalDecisionDateInterval , $ this ->locale , $ this ->includeViews );
295297 $ report = $ this ->reportFactory ->createReport ();
0 commit comments