Skip to content

Commit

Permalink
#9899 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 0d90334 commit 5718411
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions tests/jobs/doi/DepositSubmissionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,26 +159,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();

$depositSubmissionMock = Mockery::mock(DepositSubmission::class, [
0, $contextMock, new \PKP\tests\support\DoiRegistrationAgency
])
->shouldReceive('handle')
->withAnyArgs()
->andReturn(null)
->getMock();
$depositSubmissionMock = new DepositSubmission(
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($depositSubmissionMock->handle());
}
}

0 comments on commit 5718411

Please sign in to comment.