From c02a231e7ffcbcc2b7748935be5231fedfbd06b5 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Wed, 10 Jun 2026 16:19:03 +0200 Subject: [PATCH] perf(CheckSetupController): Remove BackupStaticProperties It's so slow 25s per test cases Signed-off-by: Carl Schwan --- .../lib/Controller/CheckSetupController.php | 6 ------ .../Controller/CheckSetupControllerTest.php | 18 ------------------ 2 files changed, 24 deletions(-) diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index b0b240bd855..f6c2a642e23 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -19,23 +19,17 @@ use OCP\AppFramework\Http\Attribute\OpenAPI; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; -use OCP\IConfig; -use OCP\IL10N; use OCP\IRequest; use OCP\IURLGenerator; use OCP\SetupCheck\ISetupCheckManager; -use Psr\Log\LoggerInterface; #[OpenAPI(scope: OpenAPI::SCOPE_IGNORE)] class CheckSetupController extends Controller { public function __construct( $appName, IRequest $request, - private IConfig $config, private IURLGenerator $urlGenerator, - private IL10N $l10n, private Checker $checker, - private LoggerInterface $logger, private ISetupCheckManager $setupCheckManager, ) { parent::__construct($appName, $request); diff --git a/apps/settings/tests/Controller/CheckSetupControllerTest.php b/apps/settings/tests/Controller/CheckSetupControllerTest.php index 82bce109c99..7c6f5cecc1b 100644 --- a/apps/settings/tests/Controller/CheckSetupControllerTest.php +++ b/apps/settings/tests/Controller/CheckSetupControllerTest.php @@ -14,13 +14,10 @@ use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataDisplayResponse; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\RedirectResponse; -use OCP\IConfig; -use OCP\IL10N; use OCP\IRequest; use OCP\IURLGenerator; use OCP\SetupCheck\ISetupCheckManager; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; use Test\TestCase; /** @@ -28,13 +25,9 @@ use Test\TestCase; * * @package Tests\Settings\Controller */ -#[\PHPUnit\Framework\Attributes\BackupStaticProperties(true)] class CheckSetupControllerTest extends TestCase { private IRequest&MockObject $request; - private IConfig&MockObject $config; private IURLGenerator&MockObject $urlGenerator; - private IL10N&MockObject $l10n; - private LoggerInterface&MockObject $logger; private Checker&MockObject $checker; private ISetupCheckManager&MockObject $setupCheckManager; private CheckSetupController $checkSetupController; @@ -43,25 +36,14 @@ class CheckSetupControllerTest extends TestCase { parent::setUp(); $this->request = $this->createMock(IRequest::class); - $this->config = $this->createMock(IConfig::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); - $this->l10n = $this->createMock(IL10N::class); - $this->l10n->expects($this->any()) - ->method('t') - ->willReturnCallback(function ($message, array $replace) { - return vsprintf($message, $replace); - }); $this->checker = $this->createMock(Checker::class); - $this->logger = $this->createMock(LoggerInterface::class); $this->setupCheckManager = $this->createMock(ISetupCheckManager::class); $this->checkSetupController = new CheckSetupController( 'settings', $this->request, - $this->config, $this->urlGenerator, - $this->l10n, $this->checker, - $this->logger, $this->setupCheckManager, ); }