Skip to content

Commit

Permalink
Merge remote-tracking branch 'touhidur/i10306_main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
asmecher committed Nov 21, 2024
2 parents d977572 + cdbe4cf commit ef4fa4e
Show file tree
Hide file tree
Showing 11 changed files with 822 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/pkp
Submodule pkp updated 49 files
+0 −1 api/v1/submissions/PKPSubmissionController.php
+0 −1 classes/context/SubEditorsDAO.php
+7 −0 classes/core/PKPApplication.php
+30 −9 classes/core/PKPContainer.php
+0 −1 classes/decision/DecisionType.php
+1 −1 classes/mail/mailables/AnnouncementNotify.php
+1 −1 classes/mail/mailables/EditorialReminder.php
+2 −2 classes/notification/NotificationManagerDelegate.php
+2 −2 classes/notification/PKPNotificationOperationManager.php
+0 −1 classes/notification/managerDelegate/AnnouncementNotificationManager.php
+0 −1 classes/notification/managerDelegate/EditorAssignmentNotificationManager.php
+0 −1 classes/notification/managerDelegate/EditorDecisionNotificationManager.php
+0 −1 classes/notification/managerDelegate/EditorialReportNotificationManager.php
+0 −1 classes/notification/managerDelegate/PKPApproveSubmissionNotificationManager.php
+1 −6 classes/notification/managerDelegate/PKPEditingProductionStatusNotificationManager.php
+0 −1 classes/observers/listeners/AssignEditors.php
+0 −1 classes/query/Repository.php
+0 −1 classes/submission/action/EditorAction.php
+0 −1 classes/submission/reviewer/form/PKPReviewerReviewStep3Form.php
+0 −1 controllers/grid/queries/QueriesGridHandler.php
+0 −1 controllers/grid/queries/QueryNotesGridHandler.php
+0 −1 controllers/grid/users/reviewer/form/EditReviewForm.php
+0 −2 controllers/grid/users/stageParticipant/form/PKPStageParticipantNotifyForm.php
+0 −1 jobs/email/EditorialReminder.php
+0 −1 jobs/email/ReviewReminder.php
+0 −1 jobs/invitations/RemoveExpiredInvitationsJob.php
+4 −1 jobs/notifications/NewAnnouncementNotifyUsers.php
+0 −1 jobs/notifications/StatisticsReportMail.php
+67 −8 tests/PKPTestCase.php
+77 −0 tests/jobs/bulk/BulkEmailSenderTest.php
+100 −0 tests/jobs/doi/DepositContextTest.php
+179 −0 tests/jobs/doi/DepositSubmissionTest.php
+215 −0 tests/jobs/email/EditorialReminderTest.php
+55 −0 tests/jobs/invitations/RemoveExpiredInvitationsJobTest.php
+109 −0 tests/jobs/metadata/BatchMetadataChangedJobTest.php
+109 −0 tests/jobs/metadata/MetadataChangedJobTest.php
+162 −0 tests/jobs/notifications/NewAnnouncementNotifyUsersTest.php
+169 −0 tests/jobs/notifications/StatisticsReportMailTest.php
+92 −0 tests/jobs/notifications/StatisticsReportNotifyTest.php
+131 −0 tests/jobs/statistics/ArchiveUsageStatsLogFileTest.php
+66 −0 tests/jobs/statistics/CompileContextMetricsTest.php
+79 −0 tests/jobs/statistics/CompileMonthlyMetricsTest.php
+66 −0 tests/jobs/statistics/CompileSubmissionMetricsTest.php
+66 −0 tests/jobs/statistics/RemoveDoubleClicksTest.php
+67 −0 tests/jobs/submissions/RemoveSubmissionFileFromSearchIndexJobTest.php
+67 −0 tests/jobs/submissions/RemoveSubmissionFromSearchIndexJobTest.php
+ tests/jobs/submissions/UpdateSubmissionSearchJobTest.php
+1 −1 tests/phpunit.xml
+88 −0 tests/support/DoiRegistrationAgency.php
1 change: 0 additions & 1 deletion tests/classes/monograph/SubmissionFileDAOTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public function testSubmissionFileCrud()
$submissionDao->update($submission);

$submissionDao = $this->getMockBuilder(\APP\submission\DAO::class)
->setProxyTarget(Repo::submission()->dao)
->disableOriginalConstructor()
->onlyMethods(['get'])
->getMock();
Expand Down
1 change: 0 additions & 1 deletion tests/jobs/.gitkeep

This file was deleted.

107 changes: 107 additions & 0 deletions tests/jobs/statistics/CompileCounterSubmissionDailyMetricsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

/**
* @file tests/jobs/statistics/CompileCounterSubmissionDailyMetricsTest.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief Tests for compile counter submission daily metrics job.
*/

namespace APP\tests\jobs\statistics;

use APP\jobs\statistics\CompileCounterSubmissionDailyMetrics;
use Mockery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PKP\db\DAORegistry;
use PKP\tests\PKPTestCase;

#[RunTestsInSeparateProcesses]
#[CoversClass(CompileCounterSubmissionDailyMetrics::class)]
class CompileCounterSubmissionDailyMetricsTest extends PKPTestCase
{
/**
* base64_encoded serializion from OMP 3.4.0
*/
protected string $serializedJobData = <<<END
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;

/**
* Test job is a proper instance
*/
public function testUnserializationGetProperDepositIssueJobInstance(): void
{
$this->assertInstanceOf(
CompileCounterSubmissionDailyMetrics::class,
unserialize($this->serializedJobData)
);
}

/**
* Ensure that a serialized job can be unserialized and executed
*/
public function testRunSerializedJob(): void
{
/** @var CompileCounterSubmissionDailyMetrics $compileCounterSubmissionDailyMetricsJob */
$compileCounterSubmissionDailyMetricsJob = unserialize($this->serializedJobData);

$temporaryTotalsDAOMock = Mockery::mock(\APP\statistics\TemporaryTotalsDAO::class)
->makePartial()
->shouldReceive([
'deleteCounterSubmissionDailyByLoadId' => null,
'compileCounterSubmissionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTotalsDAO', $temporaryTotalsDAOMock);

$temporaryItemInvestigationsDAOMock = Mockery::mock(\APP\statistics\TemporaryItemInvestigationsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryItemInvestigationsDAO', $temporaryItemInvestigationsDAOMock);

$temporaryItemRequestsDAOMock = Mockery::mock(\APP\statistics\TemporaryItemRequestsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryItemRequestsDAO', $temporaryItemRequestsDAOMock);

$temporaryTitleInvestigationsDAOMock = Mockery::mock(\APP\statistics\TemporaryTitleInvestigationsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTitleInvestigationsDAO', $temporaryTitleInvestigationsDAOMock);

$temporaryTitleRequestsDAO = Mockery::mock(\APP\statistics\TemporaryTitleRequestsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTitleRequestsDAO', $temporaryTitleRequestsDAO);

$compileCounterSubmissionDailyMetricsJob->handle();

$this->expectNotToPerformAssertions();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
<?php

/**
* @file tests/jobs/statistics/CompileCounterSubmissionInstitutionDailyMetricsTest.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief Tests for compile counter submission institution daily metrics job.
*/

namespace APP\tests\jobs\statistics;

use APP\jobs\statistics\CompileCounterSubmissionInstitutionDailyMetrics;
use Mockery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PKP\db\DAORegistry;
use PKP\tests\PKPTestCase;

#[RunTestsInSeparateProcesses]
#[CoversClass(CompileCounterSubmissionInstitutionDailyMetrics::class)]
class CompileCounterSubmissionInstitutionDailyMetricsTest extends PKPTestCase
{
/**
* base64_encoded serializion from OMP 3.4.0
*/
protected string $serializedJobData = <<<END
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;

/**
* Test job is a proper instance
*/
public function testUnserializationGetProperDepositIssueJobInstance(): void
{
$this->assertInstanceOf(
CompileCounterSubmissionInstitutionDailyMetrics::class,
unserialize($this->serializedJobData)
);
}

/**
* Ensure that a serialized job can be unserialized and executed
*/
public function testRunSerializedJob(): void
{
/** @var CompileCounterSubmissionInstitutionDailyMetrics $compileCounterSubmissionInstitutionDailyMetricsJob */
$compileCounterSubmissionInstitutionDailyMetricsJob = unserialize($this->serializedJobData);

$temporaryTotalsDAOMock = Mockery::mock(\APP\statistics\TemporaryTotalsDAO::class)
->makePartial()
->shouldReceive([
'deleteCounterSubmissionInstitutionDailyByLoadId' => null,
'compileCounterSubmissionInstitutionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTotalsDAO', $temporaryTotalsDAOMock);

$temporaryItemInvestigationsDAOMock = Mockery::mock(\APP\statistics\TemporaryItemInvestigationsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionInstitutionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryItemInvestigationsDAO', $temporaryItemInvestigationsDAOMock);

$temporaryItemRequestsDAOMock = Mockery::mock(\APP\statistics\TemporaryItemRequestsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionInstitutionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryItemRequestsDAO', $temporaryItemRequestsDAOMock);

$temporaryTitleInvestigationsDAOMock = Mockery::mock(\APP\statistics\TemporaryTitleInvestigationsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionInstitutionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTitleInvestigationsDAO', $temporaryTitleInvestigationsDAOMock);

$temporaryTitleRequestsDAO = Mockery::mock(\APP\statistics\TemporaryTitleRequestsDAO::class)
->makePartial()
->shouldReceive([
'compileCounterSubmissionInstitutionDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTitleRequestsDAO', $temporaryTitleRequestsDAO);

$compileCounterSubmissionInstitutionDailyMetricsJob->handle();

$this->expectNotToPerformAssertions();
}
}
67 changes: 67 additions & 0 deletions tests/jobs/statistics/CompileSeriesMetricsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?php

/**
* @file tests/jobs/statistics/CompileCounterSubmissionInstitutionDailyMetricsTest.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief Tests for compile series metrics job.
*/

namespace APP\tests\jobs\statistics;

use APP\jobs\statistics\CompileSeriesMetrics;
use Mockery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PKP\db\DAORegistry;
use PKP\tests\PKPTestCase;

#[RunTestsInSeparateProcesses]
#[CoversClass(CompileSeriesMetrics::class)]
class CompileSeriesMetricsTest extends PKPTestCase
{
/**
* base64_encoded serializion from OMP 3.4.0
*/
protected string $serializedJobData = <<<END
O:40:"APP\jobs\statistics\CompileSeriesMetrics":3:{s:9:"\0*\0loadId";s:25:"usage_events_20240130.log";s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";}
END;

/**
* Test job is a proper instance
*/
public function testUnserializationGetProperDepositIssueJobInstance(): void
{
$this->assertInstanceOf(
CompileSeriesMetrics::class,
unserialize($this->serializedJobData)
);
}

/**
* Ensure that a serialized job can be unserialized and executed
*/
public function testRunSerializedJob(): void
{
/** @var CompileSeriesMetrics $compileSeriesMetricsJob */
$compileSeriesMetricsJob = unserialize($this->serializedJobData);

$temporaryTotalsDAOMock = Mockery::mock(\APP\statistics\TemporaryTotalsDAO::class)
->makePartial()
->shouldReceive([
'compileSeriesMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTotalsDAO', $temporaryTotalsDAOMock);


$compileSeriesMetricsJob->handle();

$this->expectNotToPerformAssertions();
}
}
77 changes: 77 additions & 0 deletions tests/jobs/statistics/CompileSubmissionGeoDailyMetricsTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

/**
* @file tests/jobs/statistics/CompileSubmissionGeoDailyMetricsTest.php
*
* Copyright (c) 2024 Simon Fraser University
* Copyright (c) 2024 John Willinsky
* Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
*
* @brief Tests for compile submission geo daily metrics job.
*/

namespace APP\tests\jobs\statistics;

use APP\jobs\statistics\CompileSubmissionGeoDailyMetrics;
use Mockery;
use PHPUnit\Framework\Attributes\CoversClass;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
use PKP\db\DAORegistry;
use PKP\tests\PKPTestCase;

#[RunTestsInSeparateProcesses]
#[CoversClass(CompileSubmissionGeoDailyMetrics::class)]
class CompileSubmissionGeoDailyMetricsTest extends PKPTestCase
{
/**
* base64_encoded serializion from OMP 3.4.0
*/
protected string $serializedJobData = <<<END
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;

/**
* Test job is a proper instance
*/
public function testUnserializationGetProperDepositIssueJobInstance(): void
{
$this->assertInstanceOf(
CompileSubmissionGeoDailyMetrics::class,
unserialize($this->serializedJobData)
);
}

/**
* Ensure that a serialized job can be unserialized and executed
*/
public function testRunSerializedJob(): void
{
/** @var CompileSubmissionGeoDailyMetrics $compileSubmissionGeoDailyMetricsJob */
$compileSubmissionGeoDailyMetricsJob = unserialize($this->serializedJobData);

$temporaryTotalsDAOMock = Mockery::mock(\APP\statistics\TemporaryTotalsDAO::class)
->makePartial()
->shouldReceive([
'deleteSubmissionGeoDailyByLoadId' => null,
'compileSubmissionGeoDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTotalsDAO', $temporaryTotalsDAOMock);

$temporaryTitleInvestigationsDAOMock = Mockery::mock(\APP\statistics\TemporaryTitleInvestigationsDAO::class)
->makePartial()
->shouldReceive([
'compileSubmissionGeoDailyMetrics' => null,
])
->withAnyArgs()
->getMock();

DAORegistry::registerDAO('TemporaryTitleInvestigationsDAO', $temporaryTitleInvestigationsDAOMock);

$compileSubmissionGeoDailyMetricsJob->handle();

$this->expectNotToPerformAssertions();
}
}
Loading

0 comments on commit ef4fa4e

Please sign in to comment.