From 786a00f9f1ec2a322a04f7fe7f7e5ca04fd7c604 Mon Sep 17 00:00:00 2001 From: Adam Daley Date: Mon, 23 Mar 2026 12:15:34 +0000 Subject: [PATCH] Fixes for 2 code quality findings in `Invoice` tests (#3359) * Apply suggested fix to tests-legacy/modules/Invoice/ServiceTest.php from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> * Apply suggested fix to tests-legacy/modules/Invoice/ServiceTest.php from Copilot Autofix Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com> --- tests-legacy/modules/Invoice/ServiceTest.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests-legacy/modules/Invoice/ServiceTest.php b/tests-legacy/modules/Invoice/ServiceTest.php index 1493edefb..a1c92d1ce 100644 --- a/tests-legacy/modules/Invoice/ServiceTest.php +++ b/tests-legacy/modules/Invoice/ServiceTest.php @@ -157,6 +157,9 @@ final class ServiceTest extends \BBTestCase $subscriptionServiceMock->expects($this->atLeastOnce()) ->method('isSubscribable') ->willReturn(true); + + $invoiceItemServiceMock = $this->createMock(\Box\Mod\Invoice\ServiceInvoiceItem::class); + $modelToArrayResult = [ 'id' => 1, 'serie' => 'BB', @@ -213,9 +216,10 @@ final class ServiceTest extends \BBTestCase $di = $this->getDi(); $di['db'] = $dbMock; - $di['mod_service'] = $di->protect(function ($serviceName, $sub = '') use ($systemService, $subscriptionServiceMock) { + $di['mod_service'] = $di->protect(function ($serviceName, $sub = '') use ($systemService, $subscriptionServiceMock, $invoiceItemServiceMock) { $service = null; if ($sub == 'InvoiceItem') { + $service = $invoiceItemServiceMock; } if ($serviceName == 'system') { $service = $systemService; @@ -537,7 +541,7 @@ final class ServiceTest extends \BBTestCase 'id' => 1, ], ], - 'approve', + 'approve' => true, ]; $clientModel = new \Model_Client();