Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pkp/pkp-lib#9899 Job unit tests patch #4426

Open
wants to merge 8 commits into
base: stable-3_4_0
Choose a base branch
from
18 changes: 14 additions & 4 deletions tests/jobs/doi/DepositIssueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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([
Expand Down Expand Up @@ -100,6 +98,18 @@ public function testRunSerializedJob(): void

app()->instance(DoiRepository::class, $doiRepoMock);

$this->assertNull($depositIssueJob->handle());
/** @var \PKP\context\Context $contextMock */
$contextMock = Mockery::mock(get_class(Application::getContextDAO()->newDataObject()))
->makePartial()
->shouldReceive('getData')
->getMock();

$depositIssueMock = new DepositIssue(
0,
$contextMock,
new \PKP\tests\support\DoiRegistrationAgency()
);

$this->assertNull($depositIssueMock->handle());
}
}