From 3bbba31debd46dec57eca6ae62a0f9b39ee310ce Mon Sep 17 00:00:00 2001 From: louis Date: Wed, 18 Dec 2024 18:53:11 +0100 Subject: [PATCH 1/8] =?UTF-8?q?=E2=9C=85=20Enable=20Deprecation=20Helper?= =?UTF-8?q?=20in=20Tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- phpunit.xml | 2 +- tests/EntityListener/UserChangedListenerTest.php | 9 --------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 39d1794a..b36aa651 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -21,7 +21,7 @@ - + diff --git a/tests/EntityListener/UserChangedListenerTest.php b/tests/EntityListener/UserChangedListenerTest.php index 69ead638..89dc9384 100644 --- a/tests/EntityListener/UserChangedListenerTest.php +++ b/tests/EntityListener/UserChangedListenerTest.php @@ -30,15 +30,6 @@ public function setUp(): void ->willReturn($this->voucherRepository); $this->suspiciousChildrenHandler = $this->createMock(SuspiciousChildrenHandler::class); $this->listener = new UserChangedListener($manager, $this->suspiciousChildrenHandler); - - $this->session = $this->createMock(Session::class); - $this->request = $this->createMock(Request::class); - $this->request->method('getSession') - ->willReturn($this->session); - $this->request->query = new InputBag(); - $this->event = $this->createMock(RequestEvent::class); - $this->event->method('getRequest') - ->willReturn($this->request); } public function testPreUpdateNoRoleChanges(): void From 709dc4b2e2ecf48c9ae2587d09a01dc22268d018 Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 16:55:13 +0100 Subject: [PATCH 2/8] Add return types to Form/CustomAliasCreateType --- src/Form/CustomAliasCreateType.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Form/CustomAliasCreateType.php b/src/Form/CustomAliasCreateType.php index c96e0b63..b200da96 100644 --- a/src/Form/CustomAliasCreateType.php +++ b/src/Form/CustomAliasCreateType.php @@ -12,7 +12,7 @@ class CustomAliasCreateType extends AbstractType { public const NAME = 'create_custom_alias'; - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options) : void { $builder ->add('alias', TextType::class, ['label' => 'form.new-custom-alias']) @@ -22,7 +22,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver) : void { $resolver->setDefaults(['data_class' => 'App\Form\Model\AliasCreate']); } @@ -30,7 +30,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getBlockPrefix() + public function getBlockPrefix() : string { return self::NAME; } From 500493554df417eba52955515067da454b35f683 Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 16:58:14 +0100 Subject: [PATCH 3/8] Add return types to src/Form/RegistrationType --- src/Form/RegistrationType.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Form/RegistrationType.php b/src/Form/RegistrationType.php index b35c5408..4456bbb3 100644 --- a/src/Form/RegistrationType.php +++ b/src/Form/RegistrationType.php @@ -26,12 +26,12 @@ class RegistrationType extends AbstractType /** * RegistrationType constructor. */ - public function __construct(EntityManagerInterface $manager) + public function __construct(EntityManagerInterface $manager) : void { $this->domain = $manager->getRepository(Domain::class)->getDefaultDomain()->getName(); } - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options) : void { $transformer = new TextToEmailTransformer($this->domain); From 093a192d0a1040aa20ddecd5f9509870db71a62a Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 16:59:42 +0100 Subject: [PATCH 4/8] Add return types to AliasDeleteType --- src/Form/AliasDeleteType.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Form/AliasDeleteType.php b/src/Form/AliasDeleteType.php index 754c9ae1..72168532 100644 --- a/src/Form/AliasDeleteType.php +++ b/src/Form/AliasDeleteType.php @@ -12,7 +12,7 @@ class AliasDeleteType extends AbstractType { public const NAME = 'delete_alias'; - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options) : void { $builder ->add('password', PasswordType::class, ['label' => 'form.delete-password']) @@ -22,7 +22,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver) : void { $resolver->setDefaults(['data_class' => 'App\Form\Model\Delete']); } @@ -30,7 +30,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getBlockPrefix() + public function getBlockPrefix() : string { return self::NAME; } From f1a1e00cec4ae722fd1c2cdc5bd9554c573daa65 Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 17:00:48 +0100 Subject: [PATCH 5/8] Add return type to OpenPgpDeleteType --- src/Form/OpenPgpDeleteType.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Form/OpenPgpDeleteType.php b/src/Form/OpenPgpDeleteType.php index 4db36eae..0d4c4566 100644 --- a/src/Form/OpenPgpDeleteType.php +++ b/src/Form/OpenPgpDeleteType.php @@ -12,7 +12,7 @@ class OpenPgpDeleteType extends AbstractType { public const NAME = 'delete_openpgp'; - public function buildForm(FormBuilderInterface $builder, array $options) + public function buildForm(FormBuilderInterface $builder, array $options) : void { $builder ->add('password', PasswordType::class, ['label' => 'form.delete-password']) @@ -22,7 +22,7 @@ public function buildForm(FormBuilderInterface $builder, array $options) /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) + public function configureOptions(OptionsResolver $resolver) : void { $resolver->setDefaults(['data_class' => 'App\Form\Model\Delete']); } @@ -30,7 +30,7 @@ public function configureOptions(OptionsResolver $resolver) /** * @return string */ - public function getBlockPrefix() + public function getBlockPrefix() : string { return self::NAME; } From 97dc4245981e24846c986efb351a36b5946374fa Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 17:02:19 +0100 Subject: [PATCH 6/8] Remove type from RegistrationType constructur --- src/Form/RegistrationType.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Form/RegistrationType.php b/src/Form/RegistrationType.php index 4456bbb3..01eb6e4b 100644 --- a/src/Form/RegistrationType.php +++ b/src/Form/RegistrationType.php @@ -26,7 +26,7 @@ class RegistrationType extends AbstractType /** * RegistrationType constructor. */ - public function __construct(EntityManagerInterface $manager) : void + public function __construct(EntityManagerInterface $manager) { $this->domain = $manager->getRepository(Domain::class)->getDefaultDomain()->getName(); } From 9152d1ef5ce3c0a14bfe7441ff6db358d977b188 Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 17:28:34 +0100 Subject: [PATCH 7/8] Silence tests of legacy code --- tests/Command/UsersCheckPasswordCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Command/UsersCheckPasswordCommandTest.php b/tests/Command/UsersCheckPasswordCommandTest.php index 4a89f553..2dfdffb9 100644 --- a/tests/Command/UsersCheckPasswordCommandTest.php +++ b/tests/Command/UsersCheckPasswordCommandTest.php @@ -20,7 +20,7 @@ use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface; -class UsersCheckPasswordCommandTest extends TestCase +class LegacyUsersCheckPasswordCommandTest extends TestCase { protected $inputStream; protected $plainUser; From a91a4accb831162f36ea8dd92c3b1e3e322ad4fb Mon Sep 17 00:00:00 2001 From: t2d Date: Sat, 21 Dec 2024 17:51:04 +0100 Subject: [PATCH 8/8] Revert "Silence tests of legacy code" This reverts commit 9152d1ef5ce3c0a14bfe7441ff6db358d977b188. --- tests/Command/UsersCheckPasswordCommandTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Command/UsersCheckPasswordCommandTest.php b/tests/Command/UsersCheckPasswordCommandTest.php index 2dfdffb9..4a89f553 100644 --- a/tests/Command/UsersCheckPasswordCommandTest.php +++ b/tests/Command/UsersCheckPasswordCommandTest.php @@ -20,7 +20,7 @@ use Symfony\Component\PasswordHasher\Hasher\PasswordHasherFactoryInterface; use Symfony\Component\PasswordHasher\PasswordHasherInterface; -class LegacyUsersCheckPasswordCommandTest extends TestCase +class UsersCheckPasswordCommandTest extends TestCase { protected $inputStream; protected $plainUser;