Problem/Motivation

drupal-check results on commit hash:
source : [git] https://git.drupal.org/project/mailchimp 4138c099ecbdaeef43f506572abcab146c3f4e6a
source : http://cgit.drupalcode.org/mailchimp
Updated Oct 12, 2019


  ------ ----------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpAutomationsTest.php
 ------ ----------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpAutomationsTest was not found while trying to analyse it - autoloading is probably not configured
         properly.
 ------ ----------------------------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpCampaignsTest.php                                                                                  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpCampaignsTest was not found while trying to analyse it - autoloading is probably not configured properly.
 ------ ------------------------------------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpEcommerceTest.php                                                                                  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpEcommerceTest was not found while trying to analyse it - autoloading is probably not configured properly.
 ------ ------------------------------------------------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpListsTest.php
 ------ --------------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpListsTest was not found while trying to analyse it - autoloading is probably not configured properly.
 ------ --------------------------------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpReportsTest.php
 ------ ----------------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpReportsTest was not found while trying to analyse it - autoloading is probably not configured properly.
 ------ ----------------------------------------------------------------------------------------------------------------------------------------

 ------ ------------------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpTemplatesTest.php                                                                                  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpTemplatesTest was not found while trying to analyse it - autoloading is probably not configured properly.
 ------ ------------------------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------------------------
  Line   lib/mailchimp-api-php/tests/MailchimpTest.php
 ------ ---------------------------------------------------------------------------------------------------------------------------------
         Class Mailchimp\Tests\MailchimpTest was not found while trying to analyse it - autoloading is probably not configured properly.
 ------ ---------------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------
  Line   modules/mailchimp_campaign/src/Controller/MailchimpCampaignController.php
 ------ ---------------------------------------------------------------------------
  384    Call to deprecated function entity_load_multiple().
 ------ ---------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------
  Line   modules/mailchimp_campaign/src/Entity/MailchimpCampaign.php
 ------ -----------------------------------------------------------------------------------
  132    Call to deprecated method entityManager() of class Drupal\Core\Entity\EntityBase.
  136    Call to deprecated method entityManager() of class Drupal\Core\Entity\EntityBase.
 ------ -----------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------
  Line   modules/mailchimp_campaign/src/Plugin/Filter/FilterMailchimpCampaign.php
 ------ --------------------------------------------------------------------------
  60     Call to deprecated method entityManager() of class Drupal.
  63     Call to deprecated method entityManager() of class Drupal.
 ------ --------------------------------------------------------------------------

 ------ ----------------------------------------------------
  Line   modules/mailchimp_lists/mailchimp_lists.module
 ------ ----------------------------------------------------
  113    Call to deprecated function valid_email_address().
 ------ ----------------------------------------------------

 ------ -----------------------------------------------------------------------------------
  Line   modules/mailchimp_lists/src/Plugin/Field/FieldType/MailchimpListsSubscription.php
 ------ -----------------------------------------------------------------------------------
  104    Call to deprecated method entityManager() of class Drupal.
  108    Call to deprecated method entityManager() of class Drupal.
 ------ -----------------------------------------------------------------------------------


 [ERROR] Found 15 errors
                                                  
 

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

driverok’s picture

Issue summary: View changes
Issue tags: -midcamp2019
amateichuk’s picture

StatusFileSize
new9.39 KB
amateichuk’s picture

Status: Active » Needs review

Please check

berdir’s picture

Status: Needs review » Needs work
  1. +++ b/mailchimp.install
    @@ -21,7 +21,7 @@ function mailchimp_requirements($phase) {
     
         // Check for Mailchimp library.
    -    if (ClassLoader::classExists($config->get('api_classname'))) {
    +    if (class_exists($config->get('api_classname'), true)) {
    

    no need for implicit true argument, and it would need to be TRUE

  2. +++ b/modules/mailchimp_campaign/src/Controller/MailchimpCampaignController.php
    @@ -372,7 +367,8 @@ class MailchimpCampaignController extends ControllerBase {
     
    -    $query = $this->entityQuery->get($entity_type)
    +//    $query = $this->entityQuery->get($entity_type)
    +    $query = $this->entityTypeManager->getStorage($entity_type)->getQuery()
           ->condition('title', $q, 'CONTAINS')
    

    remove the old code, don't just comment it out.

  3. +++ b/modules/mailchimp_campaign/src/Plugin/Filter/FilterMailchimpCampaign.php
    @@ -57,10 +57,10 @@ class FilterMailchimpCampaign extends FilterBase {
     
    -    $entity_manager = \Drupal::entityManager();
    +    $entity_manager = \Drupal::entityTypeManager();
         $entity = $entity_manager->getStorage($entity_type)->load($entity_id);
         if (!empty($entity)) {
    -      $render_controller = \Drupal::entityManager()->getViewBuilder($entity->getEntityTypeId());
    +      $render_controller = \Drupal::entityTypeManager()->getViewBuilder($entity->getEntityTypeId());
           $render_array = $render_controller->view($entity, $view_mode);
    

    variable names should be improved, $entity_type_manager and also $view_builder, render_controller is a very old name for this. not directly related, but we touch this line anyway.

Additionally, the simpletest tests should be converted to functional tests, and we should add core_version_requirement per https://www.drupal.org/node/3070687.

amateichuk’s picture

StatusFileSize
new10.65 KB

Fixed problems, besides tests

primsi’s picture

@Tolyan4ik did you plan to work on the tests part too? Otherwise I can.

primsi’s picture

Status: Needs work » Needs review
StatusFileSize
new10.95 KB
new19.87 KB

Went ahead and did that bit.

drupal-check now returns only the lib parts, which we don't need/cant fix?

  ------ -------------------------------------------------------------------------------------------------------------------------------------------- 
  Line   lib/mailchimp-api-php/tests/MailchimpAutomationsTest.php                                                                                    
 ------ -------------------------------------------------------------------------------------------------------------------------------------------- 
         Class Mailchimp\Tests\MailchimpAutomationsTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ -------------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   lib/mailchimp-api-php/tests/MailchimpCampaignsTest.php                                                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
         Class Mailchimp\Tests\MailchimpCampaignsTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   lib/mailchimp-api-php/tests/MailchimpEcommerceTest.php                                                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
         Class Mailchimp\Tests\MailchimpEcommerceTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ -------------------------------------------------------------------------------------------------------------------------------------- 
  Line   lib/mailchimp-api-php/tests/MailchimpListsTest.php                                                                                    
 ------ -------------------------------------------------------------------------------------------------------------------------------------- 
         Class Mailchimp\Tests\MailchimpListsTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ -------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 
  Line   lib/mailchimp-api-php/tests/MailchimpReportsTest.php                                                                                    
 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 
         Class Mailchimp\Tests\MailchimpReportsTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ ---------------------------------------------------------------------------------------------------------------------------------------- 

 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
  Line   lib/mailchimp-api-php/tests/MailchimpTemplatesTest.php                                                                                    
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 
         Class Mailchimp\Tests\MailchimpTemplatesTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ ------------------------------------------------------------------------------------------------------------------------------------------ 

 ------ --------------------------------------------------------------------------------------------------------------------------------- 
  Line   lib/mailchimp-api-php/tests/MailchimpTest.php                                                                                    
 ------ --------------------------------------------------------------------------------------------------------------------------------- 
         Class Mailchimp\Tests\MailchimpTest was not found while trying to analyse it - autoloading is probably not configured properly.  
 ------ --------------------------------------------------------------------------------------------------------------------------------- 
berdir’s picture

Status: Needs review » Needs work

Yes, the included library has a separate issue.

  1. +++ b/modules/mailchimp_campaign/src/Plugin/Filter/FilterMailchimpCampaign.php
    @@ -39,8 +39,7 @@ class FilterMailchimpCampaign extends FilterBase {
       public static function processCallback($matches = []) {
    -    $content = '';
    -    $entity_type = $entity_id = $view_mode = '';
    +    $content = $entity_type = $entity_id = $view_mode = '';
    

    multi-assignments are afaik kinda against drupal coding standards, also this seems unrelated as we don't actually change anything here. I also don't understand why it does that loop and doesn't just set $entity_type = $matches[1] and so on. But, again, out of context, lets avoid changing that :)

  2. +++ b/modules/mailchimp_campaign/src/Plugin/Filter/FilterMailchimpCampaign.php
    @@ -57,16 +56,16 @@ class FilterMailchimpCampaign extends FilterBase {
           }
    -      $content = render($render_array);
    +      $content = render($build);
    

    render() is not actually deprecated but shouldn't really be used anymore. But a bit out of scope, also as it gets tricky as to where we should stop, comparing with how e.g. \Drupal\media\Plugin\Filter\MediaEmbed works, this doesn't handle translation, placeholders and so on. So, lets do the minimum here.

  3. +++ b/modules/mailchimp_lists/tests/src/Functional/MailchimpListsSubscriptionTest.php
    @@ -1,6 +1,7 @@
     
    -namespace Drupal\mailchimp_lists\Tests;
    +namespace Drupal\Tests\mailchimp_lists\Functional;
    +
    

    nitpick: unnecessary extra newline.

  4. +++ b/modules/mailchimp_lists/tests/src/Functional/MailchimpListsWebhookTest.php
    @@ -1,6 +1,7 @@
     
    -namespace Drupal\mailchimp_lists\Tests;
    +
    +namespace Drupal\Tests\mailchimp_lists\Functional;
    

    same.

primsi’s picture

Status: Needs work » Needs review
StatusFileSize
new1.65 KB
new19.48 KB

Thx. Addressed.

berdir’s picture

Status: Needs review » Needs work

Running the tests manually gives me the following dynamic deprecation messages:

  3x: Drupal\Tests\BrowserTestBase::$defaultTheme is required in drupal:9.0.0 when using an install profile that does not set a default theme. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.
    1x in MailchimpAPITest::testApi from Drupal\Tests\mailchimp\Functional
    1x in MailchimpAdminSettingsFormTest::testSettingsForm from Drupal\Tests\mailchimp\Functional
    1x in WebhookHashTest::testWebhook from Drupal\Tests\mailchimp\Functional

   13x: Drupal\Tests\BrowserTestBase::$defaultTheme is required in drupal:9.0.0 when using an install profile that does not set a default theme. See https://www.drupal.org/node/3083055, which includes recommendations on which theme to use.
    1x in MailchimpCampaignTest::testGetCampaign from Drupal\Tests\mailchimp_campaign\Functional
    1x in MailchimpListsSubscriptionTest::testGetMemberInfo from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsSubscriptionTest::testIsSubscribed from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsSubscriptionTest::testSubscribe from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsSubscriptionTest::testUpdateMember from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsSubscriptionTest::testUnsubscribe from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsTest::testGetList from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsTest::testMultiListRetrieval from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsTest::testGetMergevars from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsWebhookTest::testGetWebhook from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsWebhookTest::testAddWebhook from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpListsWebhookTest::testDeleteWebhook from Drupal\Tests\mailchimp_lists\Functional
    1x in MailchimpSignupFormTest::testSignUpForm from Drupal\Tests\mailchimp_signup\Functional

  1x: Support for asserting against non-boolean values in ::assertTrue is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use a different assert method, for example, ::assertNotEmpty(). See https://www.drupal.org/node/3082086
    1x in MailchimpListsSubscriptionTest::testUpdateMember from Drupal\Tests\mailchimp_lists\Functional

  1x: Entity type "mailchimp_signup" is using config schema as a fallback for a missing `config_export` definition is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. See https://www.drupal.org/node/2949023.
    1x in MailchimpSignupFormTest::testSignUpForm from Drupal\Tests\mailchimp_signup\Functional

Additionally, we need to do core_version_requirement in all info.yml files and also update composer.json as documented in https://www.drupal.org/node/3070687. And we probably want to specifiy ^8.7.7 || ^8 and remove core: 8.x.

primsi’s picture

Status: Needs work » Needs review
StatusFileSize
new7.37 KB
new24.87 KB

> Entity type "mailchimp_signup" is using config schema as a fallback for a missing `config_export`

Not sure if I did that bit correctly, there are differences between \Drupal\mailchimp_signup\Entity\MailchimpSignup and mailchimp_signup.schema.yml

> probably want to specifiy ^8.7.7 || ^8

I guess you meant "^8.7.7 || ^9" here?

primsi’s picture

StatusFileSize
new799 bytes
new24.99 KB

Adding the missing schema properties to the annotation.

berdir’s picture

  1. +++ b/modules/mailchimp_campaign/tests/modules/mailchimp_campaign_test/mailchimp_campaign_test.info.yml
    @@ -2,4 +2,3 @@ name: 'Mailchimp Campaign Test'
     description: 'Mailchimp Campaign Test Module.'
     package: Testing
    -core: 8.x
    

    this is missing the new key.

    it kinda is optional for test modules now, but only in 8.8

  2. +++ b/modules/mailchimp_lists/tests/modules/mailchimp_lists_test/mailchimp_lists_test.info.yml
    @@ -2,4 +2,3 @@ name: 'Mailchimp Lists Test'
     description: 'Mailchimp Lists Test Module.'
     package: Testing
    -core: 8.x
    

    same

I'm not sure what's up with test bot.

primsi’s picture

StatusFileSize
new1.16 KB
new25.07 KB

Adding.

berdir’s picture

Status: Needs review » Needs work

Ok, I just realized what the problem is, the composer.json doesn't specify type: drupal-module and then it gets installed in the wrong place.

That said, you could now also just skip the composer.json change entirely and then we don't have to fix that here. d.o can now set that correctly itself.

primsi’s picture

Status: Needs work » Needs review
StatusFileSize
new264 bytes
new24.81 KB

Let's see.

berdir’s picture

Status: Needs review » Needs work

What the test fails are saying :)

primsi’s picture

Status: Needs work » Needs review
StatusFileSize
new504 bytes
new24.84 KB

D'oh...

berdir’s picture

Status: Needs review » Reviewed & tested by the community

I think this is ready.

brendanthinkshout’s picture

Assigned: Unassigned » brendanthinkshout

aprice42’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

cjboranp’s picture

Using composer for both 8.x-1.12 and 8.x-1.x gives me a "core_versions_requirement" error in mailchimp_test.info.yml which lead me here.
It seems to be shown in the branch from #22 (https://git.drupalcode.org/project/mailchimp/commit/ba865cc), but the latest version of that file does not have a core requirement:

https://git.drupalcode.org/project/mailchimp/-/blob/8.x-1.x/tests/module...

https://git.drupalcode.org/project/mailchimp/-/blob/8.x-1.12/tests/modul...

I'm just pulling the module from composer, but I downloaded the files and they also seem to be missing the core_versions_requirement line.

berdir’s picture

I'd suggest creating a new issue. People won't look at closed issues, instead, create a new one and reference it here with a comment.

There is also a 2.x branch/release now, but looks like it has the same issue.