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 Oct 25, 2024
1 parent 16519d5 commit dfa7b6e
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 dfa7b6e

Please sign in to comment.