Skip to content

Commit

Permalink
pkp/pkp-lib#10306 removed direct mocking of job class
Browse files Browse the repository at this point in the history
  • Loading branch information
touhidurabir committed Sep 8, 2024
1 parent fa621d4 commit fe4d5c2
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
*/
$depositIssueMock->handle();

$this->expectNotToPerformAssertions();
Expand Down

0 comments on commit fe4d5c2

Please sign in to comment.