Found the following deprecated functions

Call to deprecated function drupal_set_message(). Deprecated in drupal:8.5.0 and is removed from drupal:9.0.0. Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.

in the file
web/modules/custom/one_time_password/src/Form/PasswordSetupForm.php

Comments

ankithashetty created an issue. See original summary.

ankithashetty’s picture

Status: Active » Needs review
StatusFileSize
new1.43 KB

Replaced the deprecated functions to make it drupal 9 ready. Please review the following patch file.

Thank You.

kim.pepper’s picture

StatusFileSize
new8.5 KB
new7.06 KB

There are a few more deprecations:

 ------ ------------------------------------------------------------------------
  Line   tests/src/Functional/PasswordSetupFormTest.php
 ------ ------------------------------------------------------------------------
  17     Usage of deprecated trait Drupal\simpletest\UserCreationTrait in class
         Drupal\Tests\one_time_password\Functional\PasswordSetupFormTest:
         in drupal:8.4.0 and is removed from drupal:9.0.0. Use
         Drupal\Tests\user\Traits\UserCreationTrait instead.
 ------ ------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------
  Line   tests/src/Functional/UserLoginEnforceTest.php
 ------ ---------------------------------------------------------------------------
  16     Usage of deprecated trait Drupal\simpletest\UserCreationTrait in class
         Drupal\Tests\one_time_password\Functional\UserLoginEnforceTest:
         in drupal:8.4.0 and is removed from drupal:9.0.0. Use
         Drupal\Tests\user\Traits\UserCreationTrait instead.
  45     Call to deprecated method getUsername() of class Drupal\user\Entity\User:
         in drupal:8.0.0 and is removed from drupal:9.0.0.
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or
         \Drupal\user\UserInterface::getDisplayName() instead.
  53     Call to deprecated method getUsername() of class Drupal\user\Entity\User:
         in drupal:8.0.0 and is removed from drupal:9.0.0.
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or
         \Drupal\user\UserInterface::getDisplayName() instead.
  63     Call to deprecated method getUsername() of class Drupal\user\Entity\User:
         in drupal:8.0.0 and is removed from drupal:9.0.0.
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or
         \Drupal\user\UserInterface::getDisplayName() instead.
  85     Call to deprecated method getUsername() of class Drupal\user\Entity\User:
         in drupal:8.0.0 and is removed from drupal:9.0.0.
         Use \Drupal\Core\Session\AccountInterface::getAccountName() or
         \Drupal\user\UserInterface::getDisplayName() instead.
 ------ ---------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------
  Line   tests/src/Kernel/ProvisioningUriItemTest.php
 ------ ----------------------------------------------------------------------------------------------
  78     Call to deprecated method setExpectedException() of class Drupal\KernelTests\KernelTestBase:
         in drupal:8.8.0 and is removed from drupal:9.0.0.
         Backward compatibility for PHPUnit 4 will no longer be supported.
  87     Call to deprecated method setExpectedException() of class Drupal\KernelTests\KernelTestBase:
         in drupal:8.8.0 and is removed from drupal:9.0.0.
         Backward compatibility for PHPUnit 4 will no longer be supported.
 ------ ----------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------------------------------
  Line   tests/src/Kernel/UserFieldAttachTest.php
 ------ ---------------------------------------------------------------------------------------------------------------------------------------
         Class Drupal\Test\one_time_password\Kernel\UserFieldAttachTest was not found while trying to analyse it - autoloading is probably not
         configured properly.
 ------ ---------------------------------------------------------------------------------------------------------------------------------------


 [ERROR] Found 9 errors

Status: Needs review » Needs work

The last submitted patch, 3: 3119395-3.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

kim.pepper’s picture

Status: Needs work » Needs review
StatusFileSize
new8.5 KB
new1.06 KB

Fix test fails.

sam152’s picture

Status: Needs review » Needs work

Couple of things left to get it passing on 9.0

kim.pepper’s picture

Status: Needs work » Needs review
StatusFileSize
new10.44 KB
new2.63 KB

Fixed failing D9 tests. Also found a bug in \Drupal\Tests\one_time_password\Kernel\UserFieldAttachTest::testFieldAccess

These lines:

$this->assertFalse($this->user->one_time_password->access('delete'), $admin);

Should be:

$this->assertFalse($this->user->one_time_password->access('delete', $admin));

Was brought up by a phpunit warning thinking $admin was the failure message and should be a string. Parameter types+=10

  • Sam152 committed ceb3b5b on 8.x-1.x authored by kim.pepper
    Issue #3119395 by kim.pepper, ankithashetty: Drupal 9 Readiness
    
sam152’s picture

Status: Needs review » Fixed

Good stuff, nice fix.

Status: Fixed » Closed (fixed)

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