From 83a14ff136144638cecb14fa4302f26d5d0f3017 Mon Sep 17 00:00:00 2001 From: Christian Hartmann Date: Wed, 11 Sep 2024 22:27:41 +0200 Subject: [PATCH] remove unused LoggerInterface dependencies Signed-off-by: Christian Hartmann --- lib/Activity/ActivityManager.php | 3 --- lib/Analytics/AnalyticsDatasource.php | 2 -- lib/Controller/PageController.php | 3 --- lib/Db/FormMapper.php | 2 -- lib/Listener/UserDeletedListener.php | 5 +---- lib/Service/ConfigService.php | 3 --- lib/Service/FormsService.php | 2 -- tests/Unit/Activity/ActivityManagerTest.php | 7 +------ tests/Unit/Analytics/AnalyticsDatasourceTest.php | 4 ---- tests/Unit/Controller/PageControllerTest.php | 6 ------ tests/Unit/Service/ConfigServiceTest.php | 6 ------ tests/Unit/Service/FormsServiceTest.php | 10 ---------- 12 files changed, 2 insertions(+), 51 deletions(-) diff --git a/lib/Activity/ActivityManager.php b/lib/Activity/ActivityManager.php index a5a158a1..c2bee47a 100644 --- a/lib/Activity/ActivityManager.php +++ b/lib/Activity/ActivityManager.php @@ -31,8 +31,6 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\Share\IShare; -use Psr\Log\LoggerInterface; - class ActivityManager { public function __construct( @@ -40,7 +38,6 @@ class ActivityManager { private ?string $userId, private IManager $manager, private IGroupManager $groupManager, - private LoggerInterface $logger, private CirclesService $circlesService, ) { } diff --git a/lib/Analytics/AnalyticsDatasource.php b/lib/Analytics/AnalyticsDatasource.php index f5b807dd..41d95b05 100644 --- a/lib/Analytics/AnalyticsDatasource.php +++ b/lib/Analytics/AnalyticsDatasource.php @@ -16,14 +16,12 @@ use OCA\Forms\Db\FormMapper; use OCA\Forms\Service\FormsService; use OCA\Forms\Service\SubmissionService; use OCP\IL10N; -use Psr\Log\LoggerInterface; class AnalyticsDatasource implements IDatasource { public function __construct( protected ?string $userId, private IL10N $l10n, - private LoggerInterface $logger, private FormMapper $formMapper, private FormsService $formsService, private SubmissionService $submissionService, diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index a66e8f3b..75e431b1 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -50,8 +50,6 @@ use OCP\IUserManager; use OCP\IUserSession; use OCP\Util; -use Psr\Log\LoggerInterface; - class PageController extends Controller { private const TEMPLATE_MAIN = 'main'; @@ -65,7 +63,6 @@ class PageController extends Controller { private IAccountManager $accountManager, private IInitialState $initialState, private IL10N $l10n, - private LoggerInterface $logger, private IUrlGenerator $urlGenerator, private IUserManager $userManager, private IUserSession $userSession, diff --git a/lib/Db/FormMapper.php b/lib/Db/FormMapper.php index 8389cc22..ed23669e 100644 --- a/lib/Db/FormMapper.php +++ b/lib/Db/FormMapper.php @@ -31,7 +31,6 @@ use OCP\AppFramework\Db\QBMapper; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\IDBConnection; use OCP\Share\IShare; -use Psr\Log\LoggerInterface; /** * @extends QBMapper
@@ -46,7 +45,6 @@ class FormMapper extends QBMapper { private QuestionMapper $questionMapper, private ShareMapper $shareMapper, private SubmissionMapper $submissionMapper, - private LoggerInterface $logger, IDBConnection $db, ) { parent::__construct($db, 'forms_v2_forms', Form::class); diff --git a/lib/Listener/UserDeletedListener.php b/lib/Listener/UserDeletedListener.php index bde71a06..a60570d3 100644 --- a/lib/Listener/UserDeletedListener.php +++ b/lib/Listener/UserDeletedListener.php @@ -29,15 +29,12 @@ use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use OCP\User\Events\UserDeletedEvent; -use Psr\Log\LoggerInterface; - /** * @implements IEventListener */ class UserDeletedListener implements IEventListener { public function __construct( - private IJobList $jobList, - private LoggerInterface $logger + private IJobList $jobList ) { } diff --git a/lib/Service/ConfigService.php b/lib/Service/ConfigService.php index ef79474f..c947292e 100644 --- a/lib/Service/ConfigService.php +++ b/lib/Service/ConfigService.php @@ -33,8 +33,6 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\IUserSession; -use Psr\Log\LoggerInterface; - class ConfigService { private ?IUser $currentUser; @@ -42,7 +40,6 @@ class ConfigService { protected string $appName, private IConfig $config, private IGroupManager $groupManager, - private LoggerInterface $logger, IUserSession $userSession ) { $this->currentUser = $userSession->getUser(); diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index d6d85510..0540e27d 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -50,7 +50,6 @@ use OCP\IUserManager; use OCP\IUserSession; use OCP\Security\ISecureRandom; use OCP\Share\IShare; -use Psr\Log\LoggerInterface; /** * Trait for getting forms information in a service @@ -68,7 +67,6 @@ class FormsService { private SubmissionMapper $submissionMapper, private ConfigService $configService, private IGroupManager $groupManager, - private LoggerInterface $logger, private IUserManager $userManager, private ISecureRandom $secureRandom, private CirclesService $circlesService, diff --git a/tests/Unit/Activity/ActivityManagerTest.php b/tests/Unit/Activity/ActivityManagerTest.php index 635a59fd..ba7121fd 100644 --- a/tests/Unit/Activity/ActivityManagerTest.php +++ b/tests/Unit/Activity/ActivityManagerTest.php @@ -34,7 +34,6 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\Share\IShare; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; use Test\TestCase; class ActivityManagerTest extends TestCase { @@ -48,9 +47,6 @@ class ActivityManagerTest extends TestCase { /** @var IGroupManager|MockObject */ private $groupManager; - /** @var LoggerInterface|MockObject */ - private $logger; - /** @var CirclesService|MockObject */ private $circlesService; @@ -58,10 +54,9 @@ class ActivityManagerTest extends TestCase { parent::setUp(); $this->manager = $this->createMock(IManager::class); $this->groupManager = $this->createMock(IGroupManager::class); - $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $this->circlesService = $this->createMock(CirclesService::class); - $this->activityManager = new ActivityManager('forms', 'currentUser', $this->manager, $this->groupManager, $this->logger, $this->circlesService); + $this->activityManager = new ActivityManager('forms', 'currentUser', $this->manager, $this->groupManager, $this->circlesService); } public function testPublishNewShare() { diff --git a/tests/Unit/Analytics/AnalyticsDatasourceTest.php b/tests/Unit/Analytics/AnalyticsDatasourceTest.php index 87c610af..af9ef657 100644 --- a/tests/Unit/Analytics/AnalyticsDatasourceTest.php +++ b/tests/Unit/Analytics/AnalyticsDatasourceTest.php @@ -31,13 +31,11 @@ use OCA\Forms\Service\FormsService; use OCA\Forms\Service\SubmissionService; use OCP\IL10N; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; use Test\TestCase; class AnalyticsDatasourceTest extends TestCase { private IL10N|MockObject $l10n; - private LoggerInterface|MockObject $logger; private FormMapper|MockObject $formMapper; private FormsService|MockObject $formsService; private SubmissionService|MockObject $submissionService; @@ -52,7 +50,6 @@ class AnalyticsDatasourceTest extends TestCase { } $this->l10n = $this->createMock(IL10N::class); - $this->logger = $this->createMock(LoggerInterface::class); $this->formMapper = $this->createMock(FormMapper::class); $this->formsService = $this->createMock(FormsService::class); $this->submissionService = $this->createMock(SubmissionService::class); @@ -60,7 +57,6 @@ class AnalyticsDatasourceTest extends TestCase { $this->analyticsDatasource = new AnalyticsDatasource( null, $this->l10n, - $this->logger, $this->formMapper, $this->formsService, $this->submissionService, diff --git a/tests/Unit/Controller/PageControllerTest.php b/tests/Unit/Controller/PageControllerTest.php index 5f926fc1..a506425f 100644 --- a/tests/Unit/Controller/PageControllerTest.php +++ b/tests/Unit/Controller/PageControllerTest.php @@ -39,7 +39,6 @@ use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; use Test\TestCase; @@ -48,9 +47,6 @@ class PageControllerTest extends TestCase { /** @var PageController */ private $pageController; - /** @var LoggerInterface|MockObject */ - private $logger; - /** @var IRequest|MockObject */ private $request; @@ -95,7 +91,6 @@ class PageControllerTest extends TestCase { $this->accountManager = $this->createMock(IAccountManager::class); $this->initialState = $this->createMock(IInitialState::class); $this->l10n = $this->createMock(IL10N::class); - $this->logger = $this->createMock(LoggerInterface::class); $this->urlGenerator = $this->createMock(IURLGenerator::class); $this->userManager = $this->createMock(IUserManager::class); $this->userSession = $this->createMock(IUserSession::class); @@ -110,7 +105,6 @@ class PageControllerTest extends TestCase { $this->accountManager, $this->initialState, $this->l10n, - $this->logger, $this->urlGenerator, $this->userManager, $this->userSession diff --git a/tests/Unit/Service/ConfigServiceTest.php b/tests/Unit/Service/ConfigServiceTest.php index c5473757..d7e39302 100644 --- a/tests/Unit/Service/ConfigServiceTest.php +++ b/tests/Unit/Service/ConfigServiceTest.php @@ -33,7 +33,6 @@ use OCP\IUser; use OCP\IUserSession; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; use Test\TestCase; @@ -48,9 +47,6 @@ class ConfigServiceTest extends TestCase { /** @var IGroupManager|MockObject */ private $groupManager; - /** @var LoggerInterface|MockObject */ - private $logger; - /** @var IUser|MockObject */ private $currentUser; @@ -59,7 +55,6 @@ class ConfigServiceTest extends TestCase { $this->config = $this->createMock(IConfig::class); $this->groupManager = $this->createMock(IGroupManager::class); - $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $userSession = $this->createMock(IUserSession::class); $this->currentUser = $this->createMock(IUser::class); @@ -74,7 +69,6 @@ class ConfigServiceTest extends TestCase { 'forms', $this->config, $this->groupManager, - $this->logger, $userSession ); } diff --git a/tests/Unit/Service/FormsServiceTest.php b/tests/Unit/Service/FormsServiceTest.php index 38ab246f..c72d9596 100644 --- a/tests/Unit/Service/FormsServiceTest.php +++ b/tests/Unit/Service/FormsServiceTest.php @@ -78,7 +78,6 @@ use OCP\Security\ISecureRandom; use OCP\Share\IShare; use PHPUnit\Framework\MockObject\MockObject; -use Psr\Log\LoggerInterface; use Test\TestCase; class FormsServiceTest extends TestCase { @@ -110,9 +109,6 @@ class FormsServiceTest extends TestCase { /** @var IGroupManager|MockObject */ private $groupManager; - /** @var LoggerInterface|MockObject */ - private $logger; - /** @var IUserManager|MockObject */ private $userManager; @@ -142,7 +138,6 @@ class FormsServiceTest extends TestCase { $this->configService = $this->createMock(ConfigService::class); $this->groupManager = $this->createMock(IGroupManager::class); - $this->logger = $this->getMockBuilder('Psr\Log\LoggerInterface')->getMock(); $this->userManager = $this->createMock(IUserManager::class); $this->secureRandom = $this->createMock(ISecureRandom::class); $this->circlesService = $this->createMock(CirclesService::class); @@ -177,7 +172,6 @@ class FormsServiceTest extends TestCase { $this->submissionMapper, $this->configService, $this->groupManager, - $this->logger, $this->userManager, $this->secureRandom, $this->circlesService, @@ -652,7 +646,6 @@ class FormsServiceTest extends TestCase { $this->submissionMapper, $this->configService, $this->groupManager, - $this->logger, $this->userManager, $this->secureRandom, $this->circlesService, @@ -893,7 +886,6 @@ class FormsServiceTest extends TestCase { $this->submissionMapper, $this->configService, $this->groupManager, - $this->logger, $this->userManager, $this->secureRandom, $this->circlesService, @@ -1006,7 +998,6 @@ class FormsServiceTest extends TestCase { $this->submissionMapper, $this->configService, $this->groupManager, - $this->logger, $this->userManager, $this->secureRandom, $this->circlesService, @@ -1239,7 +1230,6 @@ class FormsServiceTest extends TestCase { $this->submissionMapper, $this->configService, $this->groupManager, - $this->logger, $this->userManager, $this->secureRandom, $this->circlesService,