Problem/Motivation

Feed Tamper module is required by Tamper module. So I ran drupal-check tamper and display the next:

65/65 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ -------------------------------------------------------------------------------------------------------------
  Line   src/TamperInterface.php                                                                                                    
 ------ -------------------------------------------------------------------------------------------------------------
  12     Interface Drupal\tamper\TamperInterface extends deprecated interface Drupal\Component\Plugin\ConfigurablePluginInterface:  
         Drupal\Component\Plugin\ConfigurablePluginInterface is deprecated                                                          
         in Drupal 8.7.0 and will be removed before Drupal 9.0.0. You should implement                                              
         ConfigurableInterface and/or DependentPluginInterface directly as needed. If                                               
         you implement ConfigurableInterface you may choose to implement                                                            
         ConfigurablePluginInterface in Drupal 8 as well for maximum compatibility,                                                 
         however this must be removed prior to Drupal 9.                                                                            
 ------ -------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------- 
  Line   tests/src/Kernel/ChainedTamperTest.php                                                        
 ------ ---------------------------------------------------------------------------------------------- 
  46     Call to deprecated method getMock() of class Drupal\KernelTests\KernelTestBase:               
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                             
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.                            
  50     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/Unit/Adapter/TamperableComplexDataAdapterTest.php              
 ------ ------------------------------------------------------------------------- 
  33     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.5.0 and is removed from drupal:9.0.0.                        
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.       
 ------ ------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------- 
  Line   tests/src/Unit/Plugin/Tamper/ArrayFilterTest.php                                      
 ------ -------------------------------------------------------------------------------------- 
  27     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/ConvertCaseTest.php                                      
 ------ -------------------------------------------------------------------------------------- 
  38     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  61     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  84     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  107    Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  130    Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/CountryToCodeTest.php                       
 ------ ------------------------------------------------------------------------- 
  35     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.5.0 and is removed from drupal:9.0.0.                        
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.       
 ------ ------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------- 
  Line   tests/src/Unit/Plugin/Tamper/ExplodeTest.php                                          
 ------ -------------------------------------------------------------------------------------- 
  36     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  54     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/FindReplaceTest.php                                      
 ------ -------------------------------------------------------------------------------------- 
  103    Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/HashTest.php                                             
 ------ -------------------------------------------------------------------------------------- 
  31     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:               
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                     
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.                    
  73     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/HtmlEntityDecodeTest.php                                 
 ------ -------------------------------------------------------------------------------------- 
  34     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  37     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  40     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/HtmlEntityEncodeTest.php                                 
 ------ -------------------------------------------------------------------------------------- 
  34     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/ImplodeTest.php                                          
 ------ -------------------------------------------------------------------------------------- 
  30     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/RequiredTest.php                                         
 ------ -------------------------------------------------------------------------------------- 
  52     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  60     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  100    Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  115    Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  130    Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/RewriteTest.php                             
 ------ ------------------------------------------------------------------------- 
  33     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.5.0 and is removed from drupal:9.0.0.                        
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.       
 ------ ------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------- 
  Line   tests/src/Unit/Plugin/Tamper/StrPadTest.php                                           
 ------ -------------------------------------------------------------------------------------- 
  75     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/StrToTimeTest.php                                        
 ------ -------------------------------------------------------------------------------------- 
  38     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/StripTagsTest.php                                        
 ------ -------------------------------------------------------------------------------------- 
  50     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/TamperPluginTestBase.php                              
 ------ ----------------------------------------------------------------------------------- 
  27     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:            
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                  
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.                 
  47     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:            
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                  
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.                 
  58     Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:  
         https://github.com/sebastianbergmann/phpunit/issues/3369                           
  65     Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:  
         https://github.com/sebastianbergmann/phpunit/issues/3369                           
  72     Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:  
         https://github.com/sebastianbergmann/phpunit/issues/3369                           
  79     Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:  
         https://github.com/sebastianbergmann/phpunit/issues/3369                           
  86     Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:  
         https://github.com/sebastianbergmann/phpunit/issues/3369                           
  86     Call to deprecated method getMock() of class Drupal\Tests\UnitTestCase:            
         in drupal:8.5.0 and is removed from drupal:9.0.0.                                  
         Use \Drupal\Tests\PhpunitCompatibilityTrait::createMock() instead.                 
  93     Call to deprecated method assertInternalType() of class PHPUnit\Framework\Assert:  
         https://github.com/sebastianbergmann/phpunit/issues/3369                           
 ------ ----------------------------------------------------------------------------------- 

 ------ -------------------------------------------------------------------------------------- 
  Line   tests/src/Unit/Plugin/Tamper/UniqueTest.php                                           
 ------ -------------------------------------------------------------------------------------- 
  27     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/UrlDecodeTest.php                                        
 ------ -------------------------------------------------------------------------------------- 
  27     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  43     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         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/Unit/Plugin/Tamper/UrlEncodeTest.php                                        
 ------ -------------------------------------------------------------------------------------- 
  40     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  52     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  77     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
  89     Call to deprecated method setExpectedException() of class Drupal\Tests\UnitTestCase:  
         in drupal:8.8.0 and is removed from drupal:9.0.0.                                     
         Backward compatibility for PHPUnit 4 will no longer be supported.                     
 ------ -------------------------------------------------------------------------------------- 
                                                                                                         
 [ERROR] Found 47 errors

Thank's

CommentFileSizeAuthor
#26 tamper-assertIs-methods-3100431-26.patch2.77 KBMegaChriz
#22 interdiff-3100431-19-22.txt2.77 KBMegaChriz
#22 tamper-deprecation-3100431-22.patch24.08 KBMegaChriz
#20 interdiff-3100431-18-19.txt324 bytesMegaChriz
#20 tamper-deprecation-3100431-19.patch23.04 KBMegaChriz
#18 3100431-18.patch23.36 KBsja112
#17 3100431-17.patch23.37 KBsja112
#15 tamper-drupal9_deprecated-3100431-15.patch5.97 KBsja112
#8 tamper-drupal9_deprecated-3100431-8.patch5.81 KBChandru Ranganathan
#3 deprecation_fixed.png6.24 KBChandru Ranganathan
#3 tamper-drupal9_deprecated-3100431-3.patch5.8 KBChandru Ranganathan
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

gmangones created an issue. See original summary.

MegaChriz’s picture

@gmangones
Thanks for scanning. It seems the majority of the deprecation warnings are from Drupal 8.8. We cannot fix these yet, as we still support Drupal 8.7. But the deprecations introduced in Drupal 8.7 or earlier could be fixed right now.

Chandru Ranganathan’s picture

Hi guys,

Here I have added the patch to solve deprecated warnings in drupal 8.7 and earlier.

deprecation_fixed

Can anyone review it.

Thanks.

jamesdixon’s picture

Status: Needs review » Needs work

Thanks this is a big step in the right direction!

Since Feeds officially supports Drupal 8.7, if we fix deprecations beyond 8.7 then we risk breaking Tamper with Drupal 8.7.

Would you mind running the report to find deprecation issues up to Drupal 8.7 (and no further)?

The next step would be to update the patch to fix deprecations up to Drupal 8.7.

MegaChriz’s picture

Tests are failing because D8.8 cannot be tested in combination with PHP 5, so I updated the automated testing settings.

MegaChriz’s picture

  1. +++ b/src/TamperInterface.php
    @@ -2,14 +2,14 @@
    -interface TamperInterface extends PluginInspectionInterface, PluginFormInterface, ConfigurablePluginInterface {
    +interface TamperInterface extends PluginInspectionInterface, PluginFormInterface, ConfigurableInterface {
    

    It's okay to replace ConfigurablePluginInterface with ConfigurableInterface, but ConfigurablePluginInterface has one additional method called calculateDependencies(). This method should then be removed from the class TamperBase.

  2. +++ b/tests/modules/tamper_test/tamper_test.info.yml
    @@ -6,3 +6,8 @@ core: 8.x
    +
    +# Information added by Drupal.org packaging script on 2019-11-07
    +version: '8.x-1.0-alpha1+2-dev'
    +project: 'tamper'
    +datestamp: 1573148886
    

    This should be removed.

jamesdixon’s picture

Ah okay then we don't need to rewrite it to work for Drupal 8.7 only, it is passing for Drupal 8.7.

Lets work in @megachriz's feedback to the existing patch.

Chandru Ranganathan’s picture

Thanks @jamesdixon and @MegaChriz

All the requested changes are made.
Here is the updated patch.

tamper-drupal9_deprecated-3100431-8.patch

Please review it.
Thanks.

Chandru Ranganathan’s picture

Status: Needs work » Needs review
jenlampton’s picture

I believe that if you add drupal 9 as an option to the composer.json file in this project you can get a nice little Compatible with Drupal 9 badge in the Project information section on the module page.

Screenshot of the Project information section with Compatible with Drupal 9 highlighted

Below is a code sample from a module that has the badge.

"require": {
        "php": "^7.1",
       "drupal/core": "^8 || ^9"
  },

It also looks like it may possible to get the badge by adding the 'core_version_requirement' key in the modules info.yml file, which, in turn, will add the version to the require section of composer.json. Example follows.

core_version_requirement: ^8 || ^9

Do you want to include this change in the patch here or open a separate issue?

jamesdixon’s picture

Status: Needs review » Needs work

Thanks for the suggestion.

Lets add this into the patch here.

MegaChriz’s picture

@jenlampton, @jamesdixon
Good suggestion, but we can only declare Drupal 9 compatibility when all deprecations are fixed. Fixing some of the deprecation warnings breaks testing on D8.7, so we cannot add the "core_version_requirement" line until we drop support for Drupal 8.7. I propose to drop support for that version at the end of March, then we have two months to get the module compatible with Drupal 9.

Requiring drupal/core in composer.json is not necessary, by my knowledge.

MegaChriz’s picture

The D8.8 deprecations can be fixed now as well.

The composer.json change suggested in #10 isn't necessary. See @berdir's comment on #3111526-4: Add Drupal 9 into the require section of composer.json:

the .info.yml change is necessary, the composer.json change however is not and is automatically added based on the contents of the .info.yml.

sja112’s picture

Assigned: Unassigned » sja112
sja112’s picture

MegaChriz’s picture

Status: Needs review » Needs work

@sja112
Thanks for your help. The next step is to fix also all drupal:8.8.0 deprecations. See issue summary.

sja112’s picture

@megachriz I have updated the patch to fix drupal:8.8.0 deprecations.

sja112’s picture

sja112’s picture

Assigned: sja112 » Unassigned
MegaChriz’s picture

@sja112
Looks good! After applying the patch the Upgrade status reports it no longer finds errors. I inspected each change as well and all looks correct. I only removed the change in composer.json. That one didn't seem necessary to add.

I think that the D9 tests can only pass after commit. The testbot seems to have issues detecting a patch as D9 compatible when the dev version isn't compatible with D9 yet.

Status: Needs review » Needs work

The last submitted patch, 20: tamper-deprecation-3100431-19.patch, failed testing. View results

MegaChriz’s picture

assertIsString(), assertIsArray() and assertIsBool() are not available in Drupal 8.8.

So I added assertVarIsString(), assertVarIsArray() and assertVarIsBool() for these.

  • MegaChriz committed 1c40f91 on 8.x-1.x authored by sja112
    Issue #3100431 by sja112, MegaChriz, Chandru Ranganathan, jamesdixon,...
MegaChriz’s picture

Status: Needs review » Fixed

Tests for D8.8 are passing. Tests for D8.7 are failing, so in the commit support for D8.7 is now dropped, by using "^8.8 | ^9" as core_version_requirement. See also https://www.drupal.org/node/3070687.

Let's see how D9 tests will go.

MegaChriz’s picture

Good news! Tests are passing on D9: https://www.drupal.org/pift-ci-job/1677520

I guess we could schedule a new release for Tamper now.

MegaChriz’s picture

assertIsString(), assertIsArray() and assertIsBool() have just been added in Drupal 8.8:
#3126787-36: [D8 only] Add forwards-compatibility shim for assertInternalType() replacements in phpunit 6&7.

So let's remove our workaround methods again.

  • MegaChriz committed 72bd592 on 8.x-1.x
    Issue #3100431 by MegaChriz: Removed workaround for assertIs methods.
    
MegaChriz’s picture

Status: Needs review » Fixed

Great, tests are passing on both D8.8 and D9. Committed #26.

Status: Fixed » Closed (fixed)

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