From 5718411c862efa918ca909dc647f6d1c1ce98e0a Mon Sep 17 00:00:00 2001 From: Touhidur Rahman Date: Sun, 8 Sep 2024 11:57:31 +0600 Subject: [PATCH] pkp/pkp-lib#9899 removed direct mocking of job class --- tests/jobs/doi/DepositSubmissionTest.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/tests/jobs/doi/DepositSubmissionTest.php b/tests/jobs/doi/DepositSubmissionTest.php index 718384d1dfc..4eadaf8378c 100644 --- a/tests/jobs/doi/DepositSubmissionTest.php +++ b/tests/jobs/doi/DepositSubmissionTest.php @@ -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()); } }