Prepare Drupal 10 compatibility (planned for August 2022).

Running drupal-check reports:

FILE: src/UserRouteEventSubscriber.php

STATUS         LINE                           MESSAGE                           
--------------------------------------------------------------------------------
Check manually 63   Parameter $event of method                                  
                    Drupal\username_enumeration_prevention\UserRouteEventSubscri
                    ber::onException() has typehint with deprecated class       
                    Symfony\Component\HttpKernel\Event\GetResponseForExceptionEv
                    ent: since Symfony 4.3, use ExceptionEvent instead          
--------------------------------------------------------------------------------
Check manually 65   Call to deprecated method getException() of class           
                    Symfony\Component\HttpKernel\Event\GetResponseForExceptionEv
                    ent: since Symfony 4.4, use getThrowable instead            
--------------------------------------------------------------------------------
Check manually 66   Call to deprecated method setException() of class           
                    Symfony\Component\HttpKernel\Event\GetResponseForExceptionEv
                    ent: since Symfony 4.4, use setThrowable instead            
--------------------------------------------------------------------------------

FILE: username_enumeration_prevention.info.yml

STATUS         LINE                           MESSAGE                           
--------------------------------------------------------------------------------
Check manually 0    Value of core_version_requirement: ^8 || ^9 is not          
                    compatible with the next major version of Drupal core. See  
                    https://drupal.org/node/3070687.                            
--------------------------------------------------------------------------------

Thank's

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

S3b0uN3t created an issue. See original summary.

kimberlly_amaral made their first commit to this issue’s fork.

kimberlly_amaral’s picture

Assigned: Unassigned » kimberlly_amaral

I'll work on that.

kimberlly_amaral’s picture

I fixed the errors above. However when I ran drupal-check I also found the following erros about tests. Should they be fixed?

------ ---------------------------------------------------------------------------------------------------------------

Line src/UserRouteEventSubscriber.php

------ ---------------------------------------------------------------------------------------------------------------

63 Parameter $event of method Drupal\username_enumeration_prevention\UserRouteEventSubscriber::onException() has

typehint with deprecated class Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent:

since Symfony 4.3, use ExceptionEvent instead

65 Call to deprecated method getException() of class

Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent:

since Symfony 4.4, use getThrowable instead

66 Call to deprecated method setException() of class

Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent:

since Symfony 4.4, use setThrowable instead

------ ---------------------------------------------------------------------------------------------------------------

------ ---------------------------------------------------------------------------------------------------------

Line tests/src/Functional/FloodTest.php

------ ---------------------------------------------------------------------------------------------------------

15 Drupal\Tests\BrowserTestBase::$defaultTheme is required. See https://www.drupal.org/node/3083055, which

includes recommendations on which theme to use.

47 Call to deprecated method drupalPostForm() of class Drupal\Tests\BrowserTestBase:

in drupal:9.1.0 and is removed from drupal:10.0.0. Use

$this->submitForm() instead.

53 Call to deprecated method drupalPostForm() of class Drupal\Tests\BrowserTestBase:

in drupal:9.1.0 and is removed from drupal:10.0.0. Use

$this->submitForm() instead.

56 Call to deprecated method assertNoText() of class Drupal\Tests\BrowserTestBase:

in drupal:8.2.0 and is removed from drupal:10.0.0. Use

- $this->assertSession()->responseNotContains() for non-HTML responses,

like XML or Json.

- $this->assertSession()->pageTextNotContains() for HTML responses.

Unlike the deprecated assertNoText(), the passed text should be HTML

decoded, exactly as a human sees it in the browser.

60 Call to deprecated method assert() of class Drupal\Tests\BrowserTestBase:

in drupal:8.0.0 and is removed from drupal:10.0.0. Use

$this->assertTrue() instead.

------ ---------------------------------------------------------------------------------------------------------

------ ---------------------------------------------------------------------------------------------------------

Line tests/src/Functional/UserFormTest.php

------ ---------------------------------------------------------------------------------------------------------

13 Drupal\Tests\BrowserTestBase::$defaultTheme is required. See https://www.drupal.org/node/3083055, which

includes recommendations on which theme to use.

------ ---------------------------------------------------------------------------------------------------------

------ ---------------------------------------------------------------------------------------------------------

Line tests/src/Functional/UserRouteTest.php

------ ---------------------------------------------------------------------------------------------------------

13 Drupal\Tests\BrowserTestBase::$defaultTheme is required. See https://www.drupal.org/node/3083055, which

includes recommendations on which theme to use.

------ ---------------------------------------------------------------------------------------------------------

lucienchalom’s picture

Assigned: kimberlly_amaral » Unassigned
Status: Active » Needs review
Tauany Bueno’s picture

Assigned: Unassigned » Tauany Bueno

hi!
I'll work on it :)

Tauany Bueno’s picture

StatusFileSize
new2.96 KB
new1.12 KB

Hello!
I ran drupal-check and fixed the remaining compatibility problems (see attached .txt).
Changing the status to needs review.

Tauany Bueno’s picture

Assigned: Tauany Bueno » Unassigned
Joel Guerreiro Borghi Filho’s picture

Assigned: Unassigned » Joel Guerreiro Borghi Filho

I will review =)

Joel Guerreiro Borghi Filho’s picture

Changes from #7 commit are looking good to me.

I only found one deprecated warning about the $modules variable that should be protected instead of public after running the tests locally.

1x: The Drupal\Tests\username_enumeration_prevention\Functional\UserFormTest::$modules property must be declared protected. See https://www.drupal.org/node/2909426
1x in DrupalListener::startTest from Drupal\Tests\Listeners

Joel Guerreiro Borghi Filho’s picture

Assigned: Joel Guerreiro Borghi Filho » Unassigned
Tauany Bueno’s picture

Assigned: Unassigned » Tauany Bueno

i'll review it :)

Tauany Bueno’s picture

Tauany Bueno’s picture

Assigned: Tauany Bueno » Unassigned
Status: Needs review » Reviewed & tested by the community

hello!

All deprecated and drupal 10 compatibility issues seems to have been fixed, so I'm changing the status to RTBC :)

Lal_’s picture

Status: Reviewed & tested by the community » Needs work
6/6 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ----------------------------------------------- 
  Line   username_enumeration_prevention.module         
 ------ ----------------------------------------------- 
  55     Cannot call method id() on object|true.        
  55     Cannot call method isActive() on object|true.  
 ------ ----------------------------------------------- 


 [ERROR] Found 2 errors                                                                                                 

Thanks for using drupal-check!

Need to fix the phpstan issues.

Lal_’s picture

Strange, unable to run test bot on the MR. Trying to add the diff as a patch.

Lal_’s picture

StatusFileSize
new6.92 KB

PS: its a diff from the MR

Lal_’s picture

StatusFileSize
new8.29 KB

Fixing the tests

Lal_’s picture

StatusFileSize
new9.9 KB
Lal_’s picture

Status: Needs work » Needs review
kristen pol’s picture

Bot issue is #3290308: Automated Drupal 10 compatibility fixes.

It would be good to go through and combine so the patch here or there covers everything and then close out one of these issues.

mpaulo’s picture

Assigned: Unassigned » mpaulo

I'll review the patches here and on the related issue, #3290308

mpaulo’s picture

Status: Needs review » Reviewed & tested by the community

Moving to RTBC. There are no needed changes to bring from the issue #3290308.
Should the maintainers decide which issue to keep?

mpaulo’s picture

Assigned: mpaulo » Unassigned
mglaman’s picture

Status: Reviewed & tested by the community » Needs work
  1. +++ b/username_enumeration_prevention.module
    @@ -51,7 +51,7 @@ function username_enumeration_prevention_pass_validate($form, FormStateInterface
    -
    +  /** @var \Drupal\user\UserInterface $account */
    

    Not needed.

  2. +++ b/composer.json
    @@ -3,5 +3,10 @@
    +  "extra": {
    +    "drupal-lenient": {
    +      "allowed-list": ["drupal/username_enumeration_prevention"]
    +    }
    

    Remove this.

reenaraghavan’s picture

Assigned: Unassigned » reenaraghavan

nkoporec made their first commit to this issue’s fork.

nkoporec’s picture

Status: Needs work » Needs review

Updated the MR, removed the not needed type hinting and the extra composer config as @mglaman suggested.

reenaraghavan’s picture

Assigned: reenaraghavan » Unassigned
Status: Needs review » Needs work
StatusFileSize
new1.13 KB

I have made the changes and attached the patch.

Tested using Drupal check shows 2 error
------ -----------------------------------------------
Line username_enumeration_prevention.module
------ -----------------------------------------------
54 Cannot call method id() on object|true.
54 Cannot call method isActive() on object|true.
------ -----------------------------------------------

[ERROR] Found 2 errors

Tested using "Upgrade Status" and found one error, attached screenshot of that error.

reenaraghavan’s picture

StatusFileSize
new45.05 KB
mglaman’s picture

Status: Needs work » Needs review

Putting back to Needs Review:

1. We're not fixing general typehint errors
2. Your upgrade_status error is because the module wasn't installed.

mglaman’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Moving to RTBC to prevent the update bot from attaching more patches and making this thread even noiser.

reenaraghavan’s picture

@mglaman Sorry I am new to contributions, and sorry if I have done anything wrong.

mglaman’s picture

@reenaraghavan no problem! To be fair, it's my also partially my fault because of drupal-check's extra errors it outputs.

Lal_’s picture

Status: Reviewed & tested by the community » Needs work

Ignore my PR note because it's a Drupal CI problem, and we don't want that to be committed... We already have a passing patch #20.... @nkoporec if we are following the patch method let's follow that to the end... The sole reason I went for a patch was to trigger test bots run...

Lal_’s picture

Status: Needs work » Reviewed & tested by the community

oops

  • cce93fa committed on 8.x-1.x
    [#3269921] by Lal_, kimberlly_amaral, Tauany Bueno, reenaraghavan, Joel...
nicksanta’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks for your contribution everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.