Skip to content

Commit

Permalink
#5885 updated job and test based on new inviation functionality imple…
Browse files Browse the repository at this point in the history
…mentation
  • Loading branch information
touhidurabir committed Jul 1, 2024
1 parent e0e195b commit 5ffe690
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 19 deletions.
1 change: 1 addition & 0 deletions classes/task/ReviewReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public function executeActions()
->getCollector()
->filterByIsIncomplete(true)
->orderByContextId()
->orderBySubmissionId()
->getMany();

foreach ($incompleteAssignments as $reviewAssignment) {
Expand Down
13 changes: 7 additions & 6 deletions jobs/email/ReviewReminder.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ public function handle(): void
$reviewerAccessKeysEnabled = $context->getData('reviewerAccessKeysEnabled');

if ($reviewerAccessKeysEnabled) { // Give one-click access if enabled
$reviewInvitation = new ReviewerAccessInvite(
$reviewAssignment->getReviewerId(),
$context->getId(),
$reviewAssignment->getId()
);
$reviewInvitation->setMailable($mailable);
$reviewInvitation = new ReviewerAccessInvite();
$reviewInvitation->initialize($reviewAssignment->getReviewerId(), $context->getId(), null);

$reviewInvitation->reviewAssignmentId = $reviewAssignment->getId();
$reviewInvitation->updatePayload();

$reviewInvitation->dispatch();
$reviewInvitation->updateMailableWithUrl($mailable);
}

// deprecated template variables OJS 2.x
Expand Down
14 changes: 1 addition & 13 deletions tests/jobs/email/ReviewReminderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use PKP\submission\reviewAssignment\ReviewAssignment;
use APP\submission\Repository as SubmissionRepository;
use PKP\emailTemplate\Repository as EmailTemplateRepository;
use PKP\invitation\repositories\Invitation as InvitationRepository;
use PKP\submission\reviewAssignment\Repository as ReviewAssignmentRepository;
use PKP\log\event\Repository as EventRepository;
use APP\user\Repository as UserRepository;
Expand Down Expand Up @@ -158,7 +157,7 @@ public function register(\Pimple\Container $pimple)
$emailTemplateMock = Mockery::mock(\PKP\emailTemplate\EmailTemplate::class)
->makePartial()
->shouldReceive([
"getLocalizedData" => ""
'getLocalizedData' => '',
])
->withAnyArgs()
->getMock();
Expand All @@ -173,17 +172,6 @@ public function register(\Pimple\Container $pimple)

app()->instance(EmailTemplateRepository::class, $emailTemplateRepoMock);

$invitationRepoMock = Mockery::mock(app(InvitationRepository::class))
->makePartial()
->shouldReceive([
'addInvitation' => 0,
'getMailable' => null,
])
->withAnyArgs()
->getMock();

app()->instance(InvitationRepository::class, $invitationRepoMock);

$eventRepoMock = Mockery::mock(app(EventRepository::class))
->makePartial()
->shouldReceive([
Expand Down

0 comments on commit 5ffe690

Please sign in to comment.