From 9df6ffe281023db3b08cd44e1a4e178cb2c8d36d Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Wed, 4 Sep 2024 18:19:52 +0600 Subject: [PATCH 1/8] pkp/pkp-lib#9899 Submodule Update ##touhidurabir/i9899_patch_stable_3_4_0## --- lib/pkp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pkp b/lib/pkp index 93514b4688b..e9103831a9a 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit 93514b4688bdf85eb03aa6b80772460b9328ee3a +Subproject commit e9103831a9aa4b94d8e2ad4721cebfd35fbf8aff From eaf0939e4ad4a5d86f53fc07cdd96e585bdd75fb Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Fri, 6 Sep 2024 15:21:56 +0600 Subject: [PATCH 2/8] pkp/pkp-lib#9899 Updated deposite issue tests with mocked job class --- tests/jobs/doi/DepositIssueTest.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/jobs/doi/DepositIssueTest.php b/tests/jobs/doi/DepositIssueTest.php index 27e514f8f81..ad8a50dbc62 100644 --- a/tests/jobs/doi/DepositIssueTest.php +++ b/tests/jobs/doi/DepositIssueTest.php @@ -12,6 +12,7 @@ namespace APP\tests\jobs\doi; +use APP\core\Application; use APP\doi\Repository as DoiRepository; use APP\issue\Repository as IssueRepository; use APP\jobs\doi\DepositIssue; @@ -53,9 +54,6 @@ public function testRunSerializedJob(): void $this->mockGuzzleClient(); - /** @var DepositIssue $depositIssueJob */ - $depositIssueJob = unserialize($this->serializedJobData); - $issueMock = Mockery::mock(\APP\issue\Issue::class) ->makePartial() ->shouldReceive([ @@ -100,6 +98,27 @@ public function testRunSerializedJob(): void app()->instance(DoiRepository::class, $doiRepoMock); - $this->assertNull($depositIssueJob->handle()); + $contextMock = Mockery::mock(get_class(Application::getContextDAO()->newDataObject())) + ->makePartial() + ->shouldReceive('getData') + ->getMock(); + + $depositIssueMock = Mockery::mock(DepositIssue::class, [ + 0, $contextMock, new \PKP\tests\support\DoiRegistrationAgency() + ]) + ->shouldReceive('handle') + ->withAnyArgs() + ->andReturn(null) + ->getMock(); + + /** + * @disregard P1013 PHP Intelephense error suppression + * + * @see https://github.com/bmewburn/vscode-intelephense/issues/568 + * + * As mock defined it should receive `handle`, + * we will have `handle` method on mock object + */ + $this->assertNull($depositIssueMock->handle()); } } From 702f9f6b3f45317e2d79928387b2ffa1a8331409 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Sun, 8 Sep 2024 11:57:56 +0600 Subject: [PATCH 3/8] pkp/pkp-lib#9899 removed direct mocking of job class --- tests/jobs/doi/DepositIssueTest.php | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/tests/jobs/doi/DepositIssueTest.php b/tests/jobs/doi/DepositIssueTest.php index ad8a50dbc62..988c7e8a69e 100644 --- a/tests/jobs/doi/DepositIssueTest.php +++ b/tests/jobs/doi/DepositIssueTest.php @@ -98,27 +98,18 @@ public function testRunSerializedJob(): void app()->instance(DoiRepository::class, $doiRepoMock); + /** @var \PKP\context\Context $contextMock */ $contextMock = Mockery::mock(get_class(Application::getContextDAO()->newDataObject())) ->makePartial() ->shouldReceive('getData') ->getMock(); - $depositIssueMock = Mockery::mock(DepositIssue::class, [ - 0, $contextMock, new \PKP\tests\support\DoiRegistrationAgency() - ]) - ->shouldReceive('handle') - ->withAnyArgs() - ->andReturn(null) - ->getMock(); + $depositIssueMock = new DepositIssue( + 0, + $contextMock, + new \PKP\tests\support\DoiRegistrationAgency() + ); - /** - * @disregard P1013 PHP Intelephense error suppression - * - * @see https://github.com/bmewburn/vscode-intelephense/issues/568 - * - * As mock defined it should receive `handle`, - * we will have `handle` method on mock object - */ $this->assertNull($depositIssueMock->handle()); } } From 8ed92f216a61944527f212061cb7d342aa2a9b29 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Sat, 21 Sep 2024 22:44:57 +0600 Subject: [PATCH 4/8] pkp/pkp-lib#9899 fixed PHPUnit deprecation warning --- tests/jobs/doi/DepositIssueTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/jobs/doi/DepositIssueTest.php b/tests/jobs/doi/DepositIssueTest.php index 988c7e8a69e..baa22d819b3 100644 --- a/tests/jobs/doi/DepositIssueTest.php +++ b/tests/jobs/doi/DepositIssueTest.php @@ -101,7 +101,10 @@ public function testRunSerializedJob(): void /** @var \PKP\context\Context $contextMock */ $contextMock = Mockery::mock(get_class(Application::getContextDAO()->newDataObject())) ->makePartial() - ->shouldReceive('getData') + ->shouldReceive([ + 'getData' => '', + 'getLocalizedData' => '', + ]) ->getMock(); $depositIssueMock = new DepositIssue( From 43d4f7cb76b0ed54a3ec56f1606a8a0b7705f290 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Thu, 26 Sep 2024 14:05:20 +0600 Subject: [PATCH 5/8] pkp/pkp-lib#9899 notification mocks added --- .../IssuePublishedNotifyUsersTest.php | 47 +++++++++++++-- .../notifications/OpenAccessMailUsersTest.php | 57 ++++++++++++++----- 2 files changed, 87 insertions(+), 17 deletions(-) diff --git a/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php b/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php index 154b3f4ec8b..fb17566ae6a 100644 --- a/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php +++ b/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php @@ -12,11 +12,12 @@ namespace APP\tests\jobs\notifications; -use APP\jobs\notifications\IssuePublishedNotifyUsers; use Mockery; use PKP\db\DAORegistry; -use PKP\emailTemplate\Repository as EmailTemplateRepository; +use APP\core\Application; use PKP\tests\PKPTestCase; +use APP\jobs\notifications\IssuePublishedNotifyUsers; +use PKP\emailTemplate\Repository as EmailTemplateRepository; /** * @runTestsInSeparateProcesses @@ -56,11 +57,20 @@ public function testRunSerializedJob(): void /** @var IssuePublishedNotifyUsers $issuePublishedNotifyUsersJob */ $issuePublishedNotifyUsersJob = unserialize(($this->serializedJobData)); + $contextMock = Mockery::mock(get_class(Application::getContextDAO()->newDataObject())) + ->makePartial() + ->shouldReceive([ + 'getId' => 0, + 'getLocalizedData' => '', + ]) + ->withAnyArgs() + ->getMock(); + $journalDAOMock = Mockery::mock(\APP\journal\JournalDAO::class) ->makePartial() - ->shouldReceive('getId') + ->shouldReceive('getById') ->withAnyArgs() - ->andReturn(new \APP\journal\JournalDAO()) + ->andReturn($contextMock) ->getMock(); DAORegistry::registerDAO('JournalDAO', $journalDAOMock); @@ -83,6 +93,35 @@ public function testRunSerializedJob(): void app()->instance(EmailTemplateRepository::class, $emailTemplateRepoMock); + $notificationMock = Mockery::mock(\APP\notification\Notification::class) + ->makePartial() + ->shouldReceive([ + 'setData' => null, + 'getContextId' => 0, + ]) + ->withAnyArgs() + ->getMock(); + + $notifiactionDaoMock = Mockery::mock(\PKP\notification\NotificationDAO::class) + ->makePartial() + ->shouldReceive([ + 'newDataObject' => $notificationMock, + 'insertObject' => 0, + ]) + ->withAnyArgs() + ->getMock(); + + DAORegistry::registerDAO('NotificationDAO', $notifiactionDaoMock); + + $notificationSettingsDaoMock = Mockery::mock(\PKP\notification\NotificationSettingsDAO::class) + ->makePartial() + ->shouldReceive('updateNotificationSetting') + ->withAnyArgs() + ->andReturn(null) + ->getMock(); + + DAORegistry::registerDAO('NotificationSettingsDAO', $notificationSettingsDaoMock); + $this->assertNull($issuePublishedNotifyUsersJob->handle()); } } diff --git a/tests/jobs/notifications/OpenAccessMailUsersTest.php b/tests/jobs/notifications/OpenAccessMailUsersTest.php index 4248453b77d..7533c6d4833 100644 --- a/tests/jobs/notifications/OpenAccessMailUsersTest.php +++ b/tests/jobs/notifications/OpenAccessMailUsersTest.php @@ -12,12 +12,13 @@ namespace APP\tests\jobs\notifications; -use APP\issue\Repository as IssueRepository; -use APP\jobs\notifications\OpenAccessMailUsers; use Mockery; use PKP\db\DAORegistry; -use PKP\emailTemplate\Repository as EmailTemplateRepository; +use APP\core\Application; use PKP\tests\PKPTestCase; +use APP\issue\Repository as IssueRepository; +use APP\jobs\notifications\OpenAccessMailUsers; +use PKP\emailTemplate\Repository as EmailTemplateRepository; /** * @runTestsInSeparateProcesses @@ -57,20 +58,21 @@ public function testRunSerializedJob(): void /** @var OpenAccessMailUsers $openAccessMailUsersJob */ $openAccessMailUsersJob = unserialize($this->serializedJobData); + $contextMock = Mockery::mock(get_class(Application::getContextDAO()->newDataObject())) + ->makePartial() + ->shouldReceive([ + 'getId' => 0, + 'getLocalizedData' => '', + 'getPrimaryLocale' => 'en', + ]) + ->withAnyArgs() + ->getMock(); + $journalDAOMock = Mockery::mock(\APP\journal\JournalDAO::class) ->makePartial() ->shouldReceive('getId') ->withAnyArgs() - ->andReturn( - Mockery::mock(\APP\journal\Journal::class) - ->makePartial() - ->shouldReceive([ - 'getData' => '', - 'getPrimaryLocale' => 'en' - ]) - ->withAnyArgs() - ->getMock() - ) + ->andReturn($contextMock) ->getMock(); DAORegistry::registerDAO('JournalDAO', $journalDAOMock); @@ -103,6 +105,35 @@ public function testRunSerializedJob(): void app()->instance(EmailTemplateRepository::class, $emailTemplateRepoMock); + $notificationMock = Mockery::mock(\APP\notification\Notification::class) + ->makePartial() + ->shouldReceive([ + 'setData' => null, + 'getContextId' => 0, + ]) + ->withAnyArgs() + ->getMock(); + + $notifiactionDaoMock = Mockery::mock(\PKP\notification\NotificationDAO::class) + ->makePartial() + ->shouldReceive([ + 'newDataObject' => $notificationMock, + 'insertObject' => 0, + ]) + ->withAnyArgs() + ->getMock(); + + DAORegistry::registerDAO('NotificationDAO', $notifiactionDaoMock); + + $notificationSettingsDaoMock = Mockery::mock(\PKP\notification\NotificationSettingsDAO::class) + ->makePartial() + ->shouldReceive('updateNotificationSetting') + ->withAnyArgs() + ->andReturn(null) + ->getMock(); + + DAORegistry::registerDAO('NotificationSettingsDAO', $notificationSettingsDaoMock); + $this->assertNull($openAccessMailUsersJob->handle()); } } From 3531376252d279b5c7db33c5fb22066d6606afed Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Fri, 27 Sep 2024 18:49:47 +0600 Subject: [PATCH 6/8] pkp/pkp-lib#9899 added backup/restore for dao and container keys --- tests/jobs/doi/DepositIssueTest.php | 12 +++++++++ .../IssuePublishedNotifyUsersTest.php | 24 ++++++++++++++++++ .../notifications/OpenAccessMailUsersTest.php | 25 +++++++++++++++++++ ...mpileCounterSubmissionDailyMetricsTest.php | 13 ++++++++++ ...rSubmissionInstitutionDailyMetricsTest.php | 13 ++++++++++ .../statistics/CompileIssueMetricsTest.php | 11 ++++++++ .../CompileSubmissionGeoDailyMetricsTest.php | 12 +++++++++ .../CompileUniqueInvestigationsTest.php | 11 ++++++++ .../statistics/CompileUniqueRequestsTest.php | 11 ++++++++ .../DeleteUsageStatsTemporaryRecordsTest.php | 14 +++++++++++ .../ProcessUsageStatsLogFileTest.php | 14 +++++++++++ 11 files changed, 160 insertions(+) diff --git a/tests/jobs/doi/DepositIssueTest.php b/tests/jobs/doi/DepositIssueTest.php index baa22d819b3..5e3e333c304 100644 --- a/tests/jobs/doi/DepositIssueTest.php +++ b/tests/jobs/doi/DepositIssueTest.php @@ -33,6 +33,18 @@ class DepositIssueTest extends PKPTestCase O:25:"APP\\jobs\\doi\\DepositIssue":5:{s:10:"\0*\0issueId";i:1;s:10:"\0*\0context";O:19:"APP\\journal\\Journal":6:{s:5:"_data";a:73:{s:2:"id";i:1;s:7:"urlPath";s:15:"publicknowledge";s:7:"enabled";b:1;s:3:"seq";i:1;s:13:"primaryLocale";s:2:"en";s:14:"currentIssueId";i:1;s:19:"automaticDoiDeposit";b:0;s:12:"contactEmail";s:20:"rvaca@mailinator.com";s:11:"contactName";s:11:"Ramiro Vaca";s:18:"copyrightYearBasis";s:5:"issue";s:31:"copySubmissionAckPrimaryContact";b:1;s:7:"country";s:2:"IS";s:8:"currency";s:3:"CAD";s:17:"defaultReviewMode";i:2;s:18:"disableSubmissions";b:0;s:15:"doiCreationTime";s:20:"copyEditCreationTime";s:9:"doiPrefix";s:7:"10.1234";s:13:"doiSuffixType";s:7:"default";s:13:"doiVersioning";b:0;s:19:"editorialStatsEmail";b:1;s:14:"emailSignature";s:141:"


This is an automated message from Journal of Public Knowledge.

";s:19:"enableAnnouncements";b:1;s:15:"enabledDoiTypes";a:2:{i:0;s:11:"publication";i:1;s:5:"issue";}s:10:"enableDois";b:1;s:19:"enableGeoUsageStats";s:8:"disabled";s:27:"enableInstitutionUsageStats";b:0;s:9:"enableOai";b:1;s:16:"isSushiApiPublic";b:1;s:12:"itemsPerPage";i:25;s:8:"keywords";s:7:"request";s:14:"mailingAddress";s:49:"123 456th Street Burnaby, British Columbia Canada";s:13:"membershipFee";d:0;s:16:"notifyAllAuthors";b:1;s:12:"numPageLinks";i:10;s:19:"numWeeksPerResponse";i:4;s:17:"numWeeksPerReview";i:4;s:10:"onlineIssn";s:9:"0378-5955";s:17:"paymentPluginName";s:13:"PaypalPayment";s:15:"paymentsEnabled";b:1;s:9:"printIssn";s:9:"0378-5955";s:14:"publicationFee";d:0;s:20:"publisherInstitution";s:24:"Public Knowledge Project";s:18:"purchaseArticleFee";d:0;s:18:"registrationAgency";s:14:"dataciteplugin";s:25:"submissionAcknowledgement";s:10:"allAuthors";s:20:"submitWithCategories";b:0;s:20:"supportedFormLocales";a:2:{i:0;s:2:"en";i:1;s:5:"fr_CA";}s:16:"supportedLocales";a:2:{i:0;s:2:"en";i:1;s:5:"fr_CA";}s:26:"supportedSubmissionLocales";a:2:{i:0;s:2:"en";i:1;s:5:"fr_CA";}s:12:"supportEmail";s:20:"rvaca@mailinator.com";s:11:"supportName";s:11:"Ramiro Vaca";s:15:"themePluginPath";s:7:"default";s:12:"abbreviation";a:1:{s:2:"en";s:25:"publicknowledgeJ Pub Know";}s:7:"acronym";a:1:{s:2:"en";s:6:"JPKJPK";}s:16:"authorGuidelines";a:2:{s:2:"en";s:1209:"

Authors are invited to make a submission to this journal. All submissions will be assessed by an editor to determine whether they meet the aims and scope of this journal. Those considered to be a good fit will be sent for peer review before determining whether they will be accepted or rejected.

Before making a submission, authors are responsible for obtaining permission to publish any material included with the submission, such as photos, documents and datasets. All authors identified on the submission must consent to be identified as an author. Where appropriate, research should be approved by an appropriate ethics committee in accordance with the legal requirements of the study's country.

An editor may desk reject a submission if it does not meet minimum standards of quality. Before submitting, please ensure that the study design and research argument are structured and articulated properly. The title should be concise and the abstract should be able to stand on its own. This will increase the likelihood of reviewers agreeing to review the paper. When you're satisfied that your submission meets this standard, please follow the checklist below to prepare your submission.

";s:5:"fr_CA";s:44:"##default.contextSettings.authorGuidelines##";}s:17:"authorInformation";a:2:{s:2:"en";s:586:"Interested in submitting to this journal? We recommend that you review the About the Journal page for the journal's section policies, as well as the Author Guidelines. Authors need to register with the journal prior to submitting or, if already registered, can simply log in and begin the five-step process.";s:5:"fr_CA";s:715:"Intéressé-e à soumettre à cette revue ? Nous vous recommandons de consulter les politiques de rubrique de la revue à la page À propos de la revue ainsi que les Directives aux auteurs. Les auteurs-es doivent s'inscrire auprès de la revue avant de présenter une soumission, ou s'ils et elles sont déjà inscrits-es, simplement ouvrir une session et accéder au tableau de bord pour commencer les 5 étapes du processus.";}s:19:"beginSubmissionHelp";a:2:{s:2:"en";s:611:"

Thank you for submitting to the Journal of Public Knowledge. You will be asked to upload files, identify co-authors, and provide information such as the title and abstract.

Please read our Submission Guidelines if you have not done so already. When filling out the forms, provide as many details as possible in order to help our editors evaluate your work.

Once you begin, you can save your submission and come back to it later. You will be able to review and correct any information before you submit.

";s:5:"fr_CA";s:42:"##default.submission.step.beforeYouBegin##";}s:14:"clockssLicense";a:2:{s:2:"en";s:271:"This journal utilizes the CLOCKSS system to create a distributed archiving system among participating libraries and permits those libraries to create permanent archives of the journal for purposes of preservation and restoration. More...";s:5:"fr_CA";s:315:"Cette revue utilise le système CLOCKSS pour créer un système d'archivage distribué parmi les bibliothèques participantes et permet à ces bibliothèques de créer des archives permanentes de la revue à des fins de conservation et de reconstitution. En apprendre davantage... ";}s:16:"contributorsHelp";a:2:{s:2:"en";s:504:"

Add details for all of the contributors to this submission. Contributors added here will be sent an email confirmation of the submission, as well as a copy of all editorial decisions recorded against this submission.

If a contributor can not be contacted by email, because they must remain anonymous or do not have an email account, please do not enter a fake email address. You can add information about this contributor in a message to the editor at a later step in the submission process.

";s:5:"fr_CA";s:40:"##default.submission.step.contributors##";}s:13:"customHeaders";a:1:{s:2:"en";s:41:"";}s:11:"description";a:2:{s:2:"en";s:123:"

The Journal of Public Knowledge is a peer-reviewed quarterly publication on the subject of public access to science.

";s:5:"fr_CA";s:146:"

Le Journal de Public Knowledge est une publication trimestrielle évaluée par les pairs sur le thème de l'accès du public à la science.

";}s:11:"detailsHelp";a:2:{s:2:"en";s:92:"

Please provide the following details to help us manage your submission in our system.

";s:5:"fr_CA";s:35:"##default.submission.step.details##";}s:17:"forTheEditorsHelp";a:2:{s:2:"en";s:278:"

Please provide the following details in order to help our editorial team manage your submission.

When entering metadata, provide entries that you think would be most helpful to the person managing your submission. This information can be changed before publication.

";s:5:"fr_CA";s:41:"##default.submission.step.forTheEditors##";}s:20:"librarianInformation";a:2:{s:2:"en";s:361:"We encourage research librarians to list this journal among their library's electronic journal holdings. As well, it may be worth noting that this journal's open source publishing system is suitable for libraries to host for their faculty members to use with journals they are involved in editing (see Open Journal Systems).";s:5:"fr_CA";s:434:"Nous incitons les bibliothécaires à lister cette revue dans leur fonds de revues numériques. Aussi, il peut être pertinent de mentionner que ce système de publication en libre accès est conçu pour être hébergé par les bibliothèques de recherche pour que les membres de leurs facultés l'utilisent avec les revues dans lesquelles elles ou ils sont impliqués (voir Open Journal Systems).";}s:13:"lockssLicense";a:2:{s:2:"en";s:273:"This journal utilizes the LOCKSS system to create a distributed archiving system among participating libraries and permits those libraries to create permanent archives of the journal for purposes of preservation and restoration. More...";s:5:"fr_CA";s:314:"Cette revue utilise le système LOCKSS pour créer un système de distribution des archives parmi les bibliothèques participantes et afin de permettre à ces bibliothèques de créer des archives permanentes pour fins de préservation et de restauration. En apprendre davantage...";}s:4:"name";a:2:{s:2:"en";s:27:"Journal of Public Knowledge";s:5:"fr_CA";s:36:"Journal de la connaissance du public";}s:16:"openAccessPolicy";a:2:{s:2:"en";s:176:"This journal provides immediate open access to its content on the principle that making research freely available to the public supports a greater global exchange of knowledge.";s:5:"fr_CA";s:217:"Cette revue fournit le libre accès immédiat à son contenu se basant sur le principe que rendre la recherche disponible au public gratuitement facilite un plus grand échange du savoir, à l'échelle de la planète.";}s:16:"privacyStatement";a:2:{s:2:"en";s:206:"

The names and email addresses entered in this journal site will be used exclusively for the stated purposes of this journal and will not be made available for any other purpose or to any other party.

";s:5:"fr_CA";s:193:"

Les noms et courriels saisis dans le site de cette revue seront utilisés exclusivement aux fins indiquées par cette revue et ne serviront à aucune autre fin, ni à toute autre partie.

";}s:17:"readerInformation";a:2:{s:2:"en";s:654:"We encourage readers to sign up for the publishing notification service for this journal. Use the Register link at the top of the home page for the journal. This registration will result in the reader receiving the Table of Contents by email for each new issue of the journal. This list also allows the journal to claim a certain level of support or readership. See the journal's Privacy Statement, which assures readers that their name and email address will not be used for other purposes.";s:5:"fr_CA";s:716:"Nous invitons les lecteurs-trices à s'inscrire pour recevoir les avis de publication de cette revue. Utiliser le lien S'inscrire en haut de la page d'accueil de la revue. Cette inscription permettra au,à la lecteur-trice de recevoir par courriel le sommaire de chaque nouveau numéro de la revue. Cette liste permet aussi à la revue de revendiquer un certain niveau de soutien ou de lectorat. Voir la Déclaration de confidentialité de la revue qui certifie aux lecteurs-trices que leur nom et leur courriel ne seront pas utilisés à d'autres fins.";}s:10:"reviewHelp";a:2:{s:2:"en";s:368:"

Review the information you have entered before you complete your submission. You can change any of the details displayed here by clicking the edit button at the top of each section.

Once you complete your submission, a member of our editorial team will be assigned to review it. Please ensure the details you have entered here are as accurate as possible.

";s:5:"fr_CA";s:34:"##default.submission.step.review##";}s:17:"searchDescription";a:1:{s:2:"en";s:116:"The Journal of Public Knowledge is a peer-reviewed quarterly publication on the subject of public access to science.";}s:19:"submissionChecklist";a:2:{s:2:"en";s:591:"

All submissions must meet the following requirements.

  • This submission meets the requirements outlined in the Author Guidelines.
  • This submission has not been previously published, nor is it before another journal for consideration.
  • All references have been checked for accuracy and completeness.
  • All tables and figures have been numbered and labeled.
  • Permission has been obtained to publish all photos, datasets and other material provided with this submission.
";s:5:"fr_CA";s:37:"##default.contextSettings.checklist##";}s:15:"uploadFilesHelp";a:2:{s:2:"en";s:249:"

Provide any files our editorial team may need to evaluate your submission. In addition to the main work, you may wish to submit data sets, conflict of interest statements, or other supplementary files if these will be helpful for our editors.

";s:5:"fr_CA";s:39:"##default.submission.step.uploadFiles##";}}s:20:"_hasLoadableAdapters";b:0;s:27:"_metadataExtractionAdapters";a:0:{}s:25:"_extractionAdaptersLoaded";b:0;s:26:"_metadataInjectionAdapters";a:0:{}s:24:"_injectionAdaptersLoaded";b:0;}s:9:"\0*\0agency";O:43:"APP\\plugins\\generic\\datacite\\DatacitePlugin":4:{s:10:"pluginPath";s:24:"plugins/generic/datacite";s:14:"pluginCategory";s:7:"generic";s:7:"request";N;s:58:"\0APP\\plugins\\generic\\datacite\\DatacitePlugin\0_exportPlugin";N;}s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedContainerKeys() + */ + protected function getMockedContainerKeys(): array + { + return [ + ...parent::getMockedContainerKeys(), + IssueRepository::class, + DoiRepository::class, + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php b/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php index fb17566ae6a..e47ad23f929 100644 --- a/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php +++ b/tests/jobs/notifications/IssuePublishedNotifyUsersTest.php @@ -33,6 +33,30 @@ class IssuePublishedNotifyUsersTest extends PKPTestCase O:48:"APP\\jobs\\notifications\\IssuePublishedNotifyUsers":8:{s:15:"\0*\0recipientIds";O:29:"Illuminate\\Support\\Collection":2:{s:8:"\0*\0items";a:18:{i:0;i:1;i:1;i:2;i:2;i:3;i:3;i:4;i:4;i:5;i:5;i:6;i:6;i:7;i:7;i:8;i:8;i:9;i:9;i:10;i:10;i:11;i:11;i:12;i:12;i:13;i:13;i:14;i:14;i:15;i:15;i:16;i:35;i:37;i:36;i:38;}s:28:"\0*\0escapeWhenCastingToString";b:0;}s:12:"\0*\0contextId";i:1;s:8:"\0*\0issue";O:15:"APP\\issue\\Issue":6:{s:5:"_data";a:21:{s:2:"id";i:2;s:9:"journalId";i:1;s:6:"volume";i:2;s:6:"number";s:1:"1";s:4:"year";i:2015;s:9:"published";i:1;s:13:"datePublished";s:19:"2024-05-23 11:59:46";s:12:"dateNotified";N;s:12:"lastModified";s:19:"2024-05-23 11:59:46";s:12:"accessStatus";i:1;s:14:"openAccessDate";N;s:10:"showVolume";b:1;s:10:"showNumber";b:1;s:8:"showYear";b:1;s:9:"showTitle";b:0;s:13:"styleFileName";N;s:21:"originalStyleFileName";N;s:7:"urlPath";s:0:"";s:5:"doiId";i:5;s:11:"description";a:2:{s:2:"en";s:0:"";s:5:"fr_CA";s:0:"";}s:5:"title";a:2:{s:2:"en";s:0:"";s:5:"fr_CA";s:0:"";}}s:20:"_hasLoadableAdapters";b:0;s:27:"_metadataExtractionAdapters";a:0:{}s:25:"_extractionAdaptersLoaded";b:0;s:26:"_metadataInjectionAdapters";a:0:{}s:24:"_injectionAdaptersLoaded";b:0;}s:9:"\0*\0locale";s:2:"en";s:9:"\0*\0sender";O:13:"PKP\\user\\User":7:{s:5:"_data";a:22:{s:2:"id";i:1;s:8:"userName";s:5:"admin";s:8:"password";s:60:"$2y$10\$uFmYXg8/Ufa0HbskyW57Be22stFGY5qtxJZmTOae3PfDB86V3x7BW";s:5:"email";s:23:"pkpadmin@mailinator.com";s:3:"url";N;s:5:"phone";N;s:14:"mailingAddress";N;s:14:"billingAddress";N;s:7:"country";N;s:7:"locales";a:0:{}s:6:"gossip";N;s:13:"dateLastEmail";N;s:14:"dateRegistered";s:19:"2023-02-28 20:19:07";s:13:"dateValidated";N;s:13:"dateLastLogin";s:19:"2024-05-22 19:05:03";s:18:"mustChangePassword";N;s:7:"authStr";N;s:8:"disabled";b:0;s:14:"disabledReason";N;s:10:"inlineHelp";b:1;s:10:"familyName";a:1:{s:2:"en";s:5:"admin";}s:9:"givenName";a:1:{s:2:"en";s:5:"admin";}}s:20:"_hasLoadableAdapters";b:0;s:27:"_metadataExtractionAdapters";a:0:{}s:25:"_extractionAdaptersLoaded";b:0;s:26:"_metadataInjectionAdapters";a:0:{}s:24:"_injectionAdaptersLoaded";b:0;s:9:"\0*\0_roles";a:0:{}}s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";s:7:"batchId";s:36:"9c1c1368-8bb4-4179-a350-403decb700ba";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'JournalDAO', + 'NotificationDAO', + 'NotificationSettingsDAO', + ]; + } + + /** + * @see PKPTestCase::getMockedContainerKeys() + */ + protected function getMockedContainerKeys(): array + { + return [ + ...parent::getMockedContainerKeys(), + EmailTemplateRepository::class, + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/notifications/OpenAccessMailUsersTest.php b/tests/jobs/notifications/OpenAccessMailUsersTest.php index 7533c6d4833..037ed1a787c 100644 --- a/tests/jobs/notifications/OpenAccessMailUsersTest.php +++ b/tests/jobs/notifications/OpenAccessMailUsersTest.php @@ -34,6 +34,31 @@ class OpenAccessMailUsersTest extends PKPTestCase O:42:"APP\\jobs\\notifications\\OpenAccessMailUsers":6:{s:10:"\0*\0userIds";O:29:"Illuminate\\Support\\Collection":2:{s:8:"\0*\0items";a:2:{i:0;i:1;i:1;i:2;}s:28:"\0*\0escapeWhenCastingToString";b:0;}s:12:"\0*\0contextId";i:1;s:10:"\0*\0issueId";i:1;s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";s:7:"batchId";s:36:"9c1c4502-5261-4b4a-965c-256cd0eaaaa4";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'JournalDAO', + 'NotificationDAO', + 'NotificationSettingsDAO', + ]; + } + + /** + * @see PKPTestCase::getMockedContainerKeys() + */ + protected function getMockedContainerKeys(): array + { + return [ + ...parent::getMockedContainerKeys(), + IssueRepository::class, + EmailTemplateRepository::class, + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/CompileCounterSubmissionDailyMetricsTest.php b/tests/jobs/statistics/CompileCounterSubmissionDailyMetricsTest.php index ec3af712317..2c8d92902f8 100644 --- a/tests/jobs/statistics/CompileCounterSubmissionDailyMetricsTest.php +++ b/tests/jobs/statistics/CompileCounterSubmissionDailyMetricsTest.php @@ -31,6 +31,19 @@ class CompileCounterSubmissionDailyMetricsTest extends PKPTestCase O:56:"APP\\jobs\\statistics\\CompileCounterSubmissionDailyMetrics":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryTotalsDAO', + 'TemporaryItemInvestigationsDAO', + 'TemporaryItemRequestsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/CompileCounterSubmissionInstitutionDailyMetricsTest.php b/tests/jobs/statistics/CompileCounterSubmissionInstitutionDailyMetricsTest.php index 5509a9dc50c..0d44a900a97 100644 --- a/tests/jobs/statistics/CompileCounterSubmissionInstitutionDailyMetricsTest.php +++ b/tests/jobs/statistics/CompileCounterSubmissionInstitutionDailyMetricsTest.php @@ -31,6 +31,19 @@ class CompileCounterSubmissionInstitutionDailyMetricsTest extends PKPTestCase O:67:"APP\\jobs\\statistics\\CompileCounterSubmissionInstitutionDailyMetrics":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryTotalsDAO', + 'TemporaryItemInvestigationsDAO', + 'TemporaryItemRequestsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/CompileIssueMetricsTest.php b/tests/jobs/statistics/CompileIssueMetricsTest.php index edd32028dd1..5e69454c452 100644 --- a/tests/jobs/statistics/CompileIssueMetricsTest.php +++ b/tests/jobs/statistics/CompileIssueMetricsTest.php @@ -31,6 +31,17 @@ class CompileIssueMetricsTest extends PKPTestCase O:39:"APP\\jobs\\statistics\\CompileIssueMetrics":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryTotalsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/CompileSubmissionGeoDailyMetricsTest.php b/tests/jobs/statistics/CompileSubmissionGeoDailyMetricsTest.php index fdb6a9fe26f..f91f6b86d42 100644 --- a/tests/jobs/statistics/CompileSubmissionGeoDailyMetricsTest.php +++ b/tests/jobs/statistics/CompileSubmissionGeoDailyMetricsTest.php @@ -31,6 +31,18 @@ class CompileSubmissionGeoDailyMetricsTest extends PKPTestCase O:52:"APP\\jobs\\statistics\\CompileSubmissionGeoDailyMetrics":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryTotalsDAO', + 'TemporaryItemInvestigationsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/CompileUniqueInvestigationsTest.php b/tests/jobs/statistics/CompileUniqueInvestigationsTest.php index 6bc2c668408..e2a1f8f3ce1 100644 --- a/tests/jobs/statistics/CompileUniqueInvestigationsTest.php +++ b/tests/jobs/statistics/CompileUniqueInvestigationsTest.php @@ -31,6 +31,17 @@ class CompileUniqueInvestigationsTest extends PKPTestCase O:47:"APP\\jobs\\statistics\\CompileUniqueInvestigations":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryItemInvestigationsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/CompileUniqueRequestsTest.php b/tests/jobs/statistics/CompileUniqueRequestsTest.php index c8e1691a192..906a9e80dff 100644 --- a/tests/jobs/statistics/CompileUniqueRequestsTest.php +++ b/tests/jobs/statistics/CompileUniqueRequestsTest.php @@ -31,6 +31,17 @@ class CompileUniqueRequestsTest extends PKPTestCase O:41:"APP\\jobs\\statistics\\CompileUniqueRequests":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryItemRequestsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/DeleteUsageStatsTemporaryRecordsTest.php b/tests/jobs/statistics/DeleteUsageStatsTemporaryRecordsTest.php index 5a1e6b18f4f..4a2ae8908fc 100644 --- a/tests/jobs/statistics/DeleteUsageStatsTemporaryRecordsTest.php +++ b/tests/jobs/statistics/DeleteUsageStatsTemporaryRecordsTest.php @@ -31,6 +31,20 @@ class DeleteUsageStatsTemporaryRecordsTest extends PKPTestCase O:52:"APP\\jobs\\statistics\\DeleteUsageStatsTemporaryRecords":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} END; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryTotalsDAO', + 'TemporaryItemInvestigationsDAO', + 'TemporaryItemRequestsDAO', + 'TemporaryInstitutionsDAO', + ]; + } + /** * Test job is a proper instance */ diff --git a/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php b/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php index dde3fca8ba5..b654e79eedb 100644 --- a/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php +++ b/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php @@ -39,6 +39,20 @@ class ProcessUsageStatsLogFileTest extends PKPTestCase */ protected $dummyFileContent = '{"time":"2023-08-07 17:27:11","ip":"228dc4e5b6424e9dad52f21261cb2ab5f4651d9cb426d6fdb3d71d5ab8e2ae83","userAgent":"Mozilla\/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko\/20100101 Firefox\/115.0","canonicalUrl":"http:\/\/ojs-stable-3_4_0.test\/index.php\/publicknowledge\/index","assocType":256,"contextId":1,"submissionId":null,"representationId":null,"submissionFileId":null,"fileType":null,"country":null,"region":null,"city":null,"institutionIds":[],"version":"3.4.0.0","issueId":null,"issueGalleyId":null}'; + /** + * @see PKPTestCase::getMockedDAOs() + */ + protected function getMockedDAOs(): array + { + return [ + ...parent::getMockedDAOs(), + 'TemporaryTotalsDAO', + 'TemporaryItemInvestigationsDAO', + 'TemporaryItemRequestsDAO', + 'TemporaryInstitutionsDAO', + ]; + } + /** * Test job is a proper instance */ From 84c175e069a9d3fe217e5943a363334cb387d844 Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Tue, 1 Oct 2024 10:00:34 +0600 Subject: [PATCH 7/8] pkp/pkp-lib#9899 fixed usage stats file create/update issue for tests --- .../ProcessUsageStatsLogFileTest.php | 39 +++++++++++++++++-- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php b/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php index b654e79eedb..0927924ff12 100644 --- a/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php +++ b/tests/jobs/statistics/ProcessUsageStatsLogFileTest.php @@ -12,13 +12,14 @@ namespace APP\tests\jobs\statistics; -use APP\jobs\statistics\ProcessUsageStatsLogFile; -use APP\statistics\StatisticsHelper; use Mockery; +use ReflectionClass; use PKP\db\DAORegistry; use PKP\task\FileLoader; +use PKP\file\FileManager; use PKP\tests\PKPTestCase; -use ReflectionClass; +use APP\statistics\StatisticsHelper; +use APP\jobs\statistics\ProcessUsageStatsLogFile; /** * @runTestsInSeparateProcesses @@ -75,6 +76,8 @@ public function testRunSerializedJob(): void // we need to create a dummy file if not existed as to avoid mocking PHP's built in functions $dummyFile = $this->createDummyFileIfNeeded($processUsageStatsLogFileJob, 'loadId'); + $this->createArchiveDirectoryIfRequired(); + $temporaryTotalsDAOMock = Mockery::mock(\APP\statistics\TemporaryTotalsDAO::class) ->makePartial() ->shouldReceive([ @@ -142,10 +145,40 @@ protected function createDummyFileIfNeeded(ProcessUsageStatsLogFile $job, string . DIRECTORY_SEPARATOR; if (!file_exists($filePath . $fileName)) { + + // create the 'FileLoader::FILE_LOADER_PATH_DISPATCH' directory if not exists + if (!file_exists($filePath)) { + $fileManager = new FileManager(); + $fileManager->mkdirtree($filePath); + } + + touch($filePath . $fileName); + file_put_contents($filePath . $fileName, $this->dummyFileContent); return $filePath . $fileName; } return null; } + + /** + * Create the archive path/directory as needed + */ + protected function createArchiveDirectoryIfRequired(): bool + { + $filePath = StatisticsHelper::getUsageStatsDirPath() + . DIRECTORY_SEPARATOR + . FileLoader::FILE_LOADER_PATH_ARCHIVE + . DIRECTORY_SEPARATOR; + + if (file_exists($filePath)) { + return true; + } + + // create the 'FileLoader::FILE_LOADER_PATH_ARCHIVE' directory if not exists + $fileManager = new FileManager(); + $fileManager->mkdirtree($filePath); + + return file_exists($filePath); + } } From 089b65d6e5d205a940ba57a030eb82f9d7dee45c Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Fri, 8 Nov 2024 12:03:25 +0600 Subject: [PATCH 8/8] pkp/pkp-lib#9899 Submodule Update ##touhidurabir/i9899_patch_stable_3_4_0## --- lib/pkp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pkp b/lib/pkp index e9103831a9a..e853ef203b9 160000 --- a/lib/pkp +++ b/lib/pkp @@ -1 +1 @@ -Subproject commit e9103831a9aa4b94d8e2ad4721cebfd35fbf8aff +Subproject commit e853ef203b907094bf193a6f43462a2537b32ee9