Problem/Motivation

drupal-check results on commit hash:
source : [git] https://git.drupal.org/project/menu_trail_by_path eb3a9f735dc6e96de391d3f9d854016facea41dc
source : http://cgit.drupalcode.org/menu_trail_by_path


 

 ------ -------------------------------------------------------------------- 
  Line   src/Tests/MenuTrailByPathActiveTrailHtmlClassTest.php               
 ------ -------------------------------------------------------------------- 
  18     Usage of deprecated trait                                           
         Drupal\system\Tests\Menu\AssertMenuActiveTrailTrait in class        
         Drupal\menu_trail_by_path\Tests\MenuTrailByPathActiveTrailHtmlClas  
         sTest.                                                              
 ------ -------------------------------------------------------------------- 

 [ERROR] Found 1 error                                                      
 

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

mcdwayne created an issue. See original summary.

sergiu stici’s picture

Status: Active » Needs review
StatusFileSize
new693 bytes

Here is the patch, please review.

berdir’s picture

Status: Needs review » Needs work

It's not as simple as that, the trait is deprecated because it's now a BrowserTestBase test, but we still are a simpletest test. That should be updated and moved to the correct place, namespace and base class.

Also, lets mark this as compatible with D9 by adding the constraint: https://www.drupal.org/node/3070687 to info.yml and composer.json.

The trait was deprecated in 8.4 already, so I think it's fine to just say ^8 || ^9, we could make it a ^8.4 in composer.json.

sahana _n’s picture

Status: Needs work » Needs review
StatusFileSize
new798 bytes

Please review the patch.

jaykandari’s picture

Status: Needs review » Needs work

Running drupal-check retrusn following errors:

➜  menu_trail_by_path git:(8.x-1.x) ✗ drupal-check .
 10/10 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   src/Tests/MenuTrailByPathActiveTrailHtmlClassTest.php                                                                                                            
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 
  18     Class Drupal\menu_trail_by_path\Tests\MenuTrailByPathActiveTrailHtmlClassTest extends deprecated class Drupal\simpletest\WebTestBase:                            
         in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,                                                                                                       
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.                                                                                      
  20     Usage of deprecated trait Drupal\system\Tests\Menu\AssertMenuActiveTrailTrait in class Drupal\menu_trail_by_path\Tests\MenuTrailByPathActiveTrailHtmlClassTest:  
         in drupal:8.?.? and is removed from drupal:9.0.0.                                                                                                                
         Use \Drupal\Tests\system\Functional\Menu\AssertMenuActiveTrailTrait instead.                                                                                     
  45     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:                                                                                        
         in drupal:8.8.0 and is removed from drupal:9.0.0. Instead,                                                                                                       
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.                                                                                      
 ------ ----------------------------------------------------------------------------------------------------------------------------------------------------------------- 

                                                                                                                        
 [ERROR] Found 3 errors                                                                                                 
                                                                                                                        

sahana _n’s picture

Status: Needs work » Needs review
StatusFileSize
new1.91 KB

Please review the patch.

berdir’s picture

Status: Needs review » Needs work
+++ b/src/Tests/MenuTrailByPathActiveTrailHtmlClassTest.php
@@ -8,14 +8,15 @@ use Drupal\menu_link_content\Entity\MenuLinkContent;
  */
-class MenuTrailByPathActiveTrailHtmlClassTest extends WebTestBase {
+class MenuTrailByPathActiveTrailHtmlClassTest extends BrowserTestBase {
 
   use AssertMenuActiveTrailTrait;

just changing the base class is not enough, the class needs to be moved to tests/src/Functional and the namespace has to be updated.

andreyjan’s picture

Status: Needs work » Needs review
StatusFileSize
new1.87 KB
new2.98 KB

Fixed and added some code improvements.

berdir’s picture

StatusFileSize
new3.92 KB
new2.97 KB

Was unsure about this one. There are theme install and path alias related 8.8 only deprecations, but all deprecations are actually only in/with the test.

I've updated it to require 8.8 and will just let it sit here for a while, will do a release that is compatible with earlier versions first.

I've also fixed the license in composer.json (a drupal module must be GPL) and removed the version line in .info.yml.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

  • Berdir committed 084f340 on 8.x-1.x
    Issue #3042759 by Sahana _N, Berdir, andreyjan, Sergiu Stici: Drupal 9...
berdir’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

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