diff --git a/tests/jobs/doi/DepositIssueTest.php b/tests/jobs/doi/DepositIssueTest.php index 7ad142f916d..8a83bdedaad 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; @@ -52,9 +53,6 @@ public function testRunSerializedJob(): void $this->mockGuzzleClient(); - /** @var DepositIssue $depositIssueJob */ - $depositIssueJob = unserialize($this->serializedJobData); - $issueMock = Mockery::mock(\APP\issue\Issue::class) ->makePartial() ->shouldReceive([ @@ -100,7 +98,28 @@ public function testRunSerializedJob(): void app()->instance(DoiRepository::class, $doiRepoMock); - $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 + */ + $depositIssueMock->handle(); $this->expectNotToPerformAssertions(); }