forked from pkp/pkp-lib
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp#10306 added unit test for job RemoveExpiredInvitationsJob
- Loading branch information
1 parent
3e1cd67
commit 52a5370
Showing
2 changed files
with
54 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
tests/jobs/invitations/RemoveExpiredInvitationsJobTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
/** | ||
* @file tests/jobs/submissions/UpdateSubmissionSearchJobTest.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 the submission search reindexing job. | ||
*/ | ||
|
||
namespace PKP\tests\jobs\submissions; | ||
|
||
use PKP\tests\PKPTestCase; | ||
use PKP\jobs\invitations\RemoveExpiredInvitationsJob; | ||
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses; | ||
use PHPUnit\Framework\Attributes\CoversClass; | ||
|
||
#[RunTestsInSeparateProcesses] | ||
#[CoversClass(RemoveExpiredInvitationsJob::class)] | ||
class RemoveExpiredInvitationsJobTest extends PKPTestCase | ||
{ | ||
/** | ||
* serializion from OJS 3.4.0 | ||
*/ | ||
protected string $serializedJobData = <<<END | ||
O:48:"PKP\jobs\invitations\RemoveExpiredInvitationsJob":2:{s:10:"connection";s:8:"database";s:5:"queue";s:5:"queue";} | ||
END; | ||
|
||
/** | ||
* Test job is a proper instance | ||
*/ | ||
public function testUnserializationGetProperJobInstance(): void | ||
{ | ||
$this->assertInstanceOf( | ||
RemoveExpiredInvitationsJob::class, | ||
unserialize($this->serializedJobData) | ||
); | ||
} | ||
|
||
/** | ||
* Ensure that a serialized job can be unserialized and executed | ||
*/ | ||
public function testRunSerializedJob(): void | ||
{ | ||
/** @var RemoveExpiredInvitationsJob $removeExpiredInvitationsJob */ | ||
$removeExpiredInvitationsJob = unserialize($this->serializedJobData); | ||
|
||
// Test that the job can be handled without causing an exception. | ||
$this->assertNull($removeExpiredInvitationsJob->handle()); | ||
} | ||
} | ||
|