Skip to content

Commit

Permalink
pkp/pkp-lib#9899 removed direct mocking of job class
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Sep 27, 2024
1 parent 31bf5f3 commit 99b5589
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions tests/jobs/doi/DepositIssueTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,18 @@ public function testRunSerializedJob(): void

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

/** @var \PKP\context\Context $contextMock */
$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();
$depositIssueMock = new DepositIssue(
0,
$contextMock,
new \PKP\tests\support\DoiRegistrationAgency()
);

/**
* @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
*/
$this->assertNull($depositIssueMock->handle());
}
}

0 comments on commit 99b5589

Please sign in to comment.