With the help of drupal-check tool following list of issues has been found:

➜  drupal8_local git:(8.8.x) ✗ drupal-check modules/contrib/google_analytics
 18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ -----------------------------------------------------------------------------------
  Line   google_analytics.module
 ------ -----------------------------------------------------------------------------------
  212    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  220    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  503    Call to deprecated function file_prepare_directory():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
  505    Call to deprecated function file_unmanaged_save_data():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::saveData().
  508    Call to deprecated function file_unmanaged_save_data():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::saveData().
  519    Call to deprecated function file_prepare_directory():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
  522    Call to deprecated function file_unmanaged_save_data():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::saveData().
  525    Call to deprecated function file_unmanaged_save_data():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::saveData().
  549    Call to deprecated function file_prepare_directory():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
  652    Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strtolower() instead.
  656    Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strtolower() instead.
 ------ -----------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------
  Line   src/Form/GoogleAnalyticsAdminSettingsForm.php
 ------ -----------------------------------------------------------------------------------
  568    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  577    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  706    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  927    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  930    Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strlen() instead.
  975    Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode:
         in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
         mb_strtolower() instead.
 ------ -----------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsBasicTest.php
 ------ ----------------------------------------------------------------------------------------------------------------------
  14     Class Drupal\google_analytics\Tests\GoogleAnalyticsBasicTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  38     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ ----------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsCustomDimensionsAndMetricsTest.php
 ------ -------------------------------------------------------------------------------------------------------------------------------------------
  15     Class Drupal\google_analytics\Tests\GoogleAnalyticsCustomDimensionsAndMetricsTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  28     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ -------------------------------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsCustomUrls.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  12     Class Drupal\google_analytics\Tests\GoogleAnalyticsCustomUrls extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  25     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsPhpFilterTest.php
 ------ --------------------------------------------------------------------------------------------------------------------------
  15     Class Drupal\google_analytics\Tests\GoogleAnalyticsPhpFilterTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  28     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ --------------------------------------------------------------------------------------------------------------------------

 ------ ----------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsRolesTest.php
 ------ ----------------------------------------------------------------------------------------------------------------------
  13     Class Drupal\google_analytics\Tests\GoogleAnalyticsRolesTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  26     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ ----------------------------------------------------------------------------------------------------------------------

 ------ -----------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsSearchTest.php
 ------ -----------------------------------------------------------------------------------------------------------------------
  12     Class Drupal\google_analytics\Tests\GoogleAnalyticsSearchTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  25     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ -----------------------------------------------------------------------------------------------------------------------

 ------ -------------------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsStatusMessagesTest.php
 ------ -------------------------------------------------------------------------------------------------------------------------------
  12     Class Drupal\google_analytics\Tests\GoogleAnalyticsStatusMessagesTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  25     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ -------------------------------------------------------------------------------------------------------------------------------

 ------ --------------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsUninstallTest.php
 ------ --------------------------------------------------------------------------------------------------------------------------
  12     Class Drupal\google_analytics\Tests\GoogleAnalyticsUninstallTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  25     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  55     Call to deprecated function file_prepare_directory():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
  69     Call to deprecated function file_prepare_directory():
         in Drupal 8.7.0, will be removed before Drupal 9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
 ------ --------------------------------------------------------------------------------------------------------------------------

 ------ ---------------------------------------------------------------------------------------------------------------------------
  Line   src/Tests/GoogleAnalyticsUserFieldsTest.php
 ------ ---------------------------------------------------------------------------------------------------------------------------
  12     Class Drupal\google_analytics\Tests\GoogleAnalyticsUserFieldsTest extends deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
  25     Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
         in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
         use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
 ------ ---------------------------------------------------------------------------------------------------------------------------


 [ERROR] Found 37 errors
CommentFileSizeAuthor
#53 3072207-53.patch63.78 KBjcnventura
#53 interdiff_47_53.txt771 bytesjcnventura
#51 google_analytics_upgrade_status_report.png48.51 KBChris Matthews
#51 google_analytics_d9.png22.7 KBChris Matthews
#47 3072207-47-interdiff.txt1.45 KBkim.pepper
#47 3072207-47.patch63.86 KBkim.pepper
#45 3072207-45-interdiff.txt2.5 KBkim.pepper
#45 3072207-45.patch63.89 KBkim.pepper
#40 3072207-39.patch64.58 KBlhridley
#38 3072207-38.patch63.8 KBandreyjan
#38 3072207-interdiff--26-38.txt1.92 KBandreyjan
#35 interdiff_26-35.txt107.58 KBneelam_wadhwani
#35 3072207-35.patch57.41 KBneelam_wadhwani
#32 3072207-32.patch68.76 KBneelam_wadhwani
#30 interdiff_26-30.txt57.76 KBneelam_wadhwani
#30 3072207-30.patch68.31 KBneelam_wadhwani
#26 3072207-26.patch63.03 KBandreyjan
#26 3072207-interdiff--23-26.txt715 bytesandreyjan
#23 3072207-23.patch62.95 KBandreyjan
#23 3072207-interdiff--21-23.txt6.55 KBandreyjan
#21 3072207-21.patch59.57 KBchr.fritsch
#20 3072207.patch59.57 KBchr.fritsch
#18 interdiff-14-17.txt9.06 KBthalles
#17 3072207-17.patch4.66 KBSahana _N
#14 google_analytics_deprecated-3072207-14.patch5.9 KBpranit84
#13 google_analytics_deprecated-3072207-13.patch8.54 KBpranit84
#12 google_analytics_deprecated-3072207-12.patch8.97 KBpranit84
#11 google_analytics_deprecated-3072207-11.patch10.6 KBpranit84
#7 google_analytics_deprecated-3072207-7.patch11.02 KBpranit84
#5 google_analytics_deprecated-3072207-4.patch10.03 KBpranit84
#2 google_analytics_deprecated-3072207-2.patch15.38 KBpranit84
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

pranit84 created an issue. See original summary.

pranit84’s picture

Created a patch to fix all the Drupal-check related issues.
Now, It has no drupal-check issues.

➜ drupal8_local git:(8.8.x) ✗ drupal-check modules/contrib/google_analytics
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

[OK] No errors

pranit84’s picture

Status: Active » Needs review
hass’s picture

Status: Needs review » Needs work

Failed

pranit84’s picture

Created a new patch to solve the drupal-check issues.

➜ drupal8_local git:(8.8.x) ✗ drupal-check modules/contrib/google_analytics
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

[OK] No errors

pranit84’s picture

Version: 8.x-3.x-dev » 8.x-2.x-dev
pranit84’s picture

thalles’s picture

Issue summary: View changes
thalles’s picture

Some of these methods / functions should not be overridden at this time because they were incorporated in 8.7, then broken sites with 8.6.

@See:
https://www.drupal.org/node/3006851

pranit84’s picture

This means we cannot fix all the drupal-check related issues as of now, as it results in some other errors.

pranit84’s picture

Trying another patch with a deprecated function file_prepare_directory in a module file.

pranit84’s picture

pranit84’s picture

pranit84’s picture

pranit84’s picture

As mentioned here: https://www.drupal.org/node/3006851 using any services related to file system results in errors.

Here in this module, we are using 2 deprecated functions because related services are throwing errors.

Functions:
file_unmanaged_copy($source, $destination, $replace)
file_unmanaged_prepare($source, $destination, $replace)
file_unmanaged_move($source, $destination, $replace)
file_unmanaged_delete($path)
file_unmanaged_delete_recursive($path, $callback)
file_unmanaged_save_data($data, $destination, $replace)
file_prepare_directory($dir)
file_destination($destination, $replace)
file_create_filename($basename, $directory)

Services:
\Drupal::service('file_system')->copy($source, $destination, $replace);
\Drupal::service('file_system')->move($source, $destination, $replace);
\Drupal::service('file_system')->delete($path);
\Drupal::service('file_system')->deleteRecursive($path, $callback);
\Drupal::service('file_system')->saveData();
\Drupal::service('file_system')->prepareDirectory($directory, $options);
\Drupal::service('file_system')->getDestinationFilename($destination, $replace);
\Drupal::service('file_system')->createFilename($basename, $directory);

Kristen Pol’s picture

Title: Drupal 9 readiness related issues should be fixed. » Drupal 9 compatibility related issues should be fixed.
Issue tags: +Drupal 9 compatibility
Sahana _N’s picture

Status: Needs work » Needs review
FileSize
4.66 KB

Removed deprecated methods please review the patch.

thalles’s picture

FileSize
9.06 KB

Follow a interdiff.

chr.fritsch’s picture

Status: Needs review » Needs work
  1. +++ b/google_analytics.module
    @@ -499,12 +500,12 @@ function _google_analytics_cache($location, $synchronize = FALSE) {
    +          $filesystem->saveData($data, $file_destination, FILE_EXISTS_REPLACE);
    ...
    +            $filesystem->saveData(gzencode($data, 9, FORCE_GZIP), $file_destination . '.gz', FILE_EXISTS_REPLACE);
    
    @@ -515,13 +516,13 @@ function _google_analytics_cache($location, $synchronize = FALSE) {
    -            file_unmanaged_save_data(gzencode($data, 9, FORCE_GZIP), $file_destination . '.gz', FILE_EXISTS_REPLACE);
    

    The constants are also deprecated.

  2. +++ b/src/Tests/GoogleAnalyticsUninstallTest.php
    +++ b/src/Tests/GoogleAnalyticsUninstallTest.php
    @@ -52,7 +52,7 @@ class GoogleAnalyticsUninstallTest extends WebTestBase {
    
    @@ -52,7 +52,7 @@ class GoogleAnalyticsUninstallTest extends WebTestBase {
    @@ -66,7 +66,7 @@ class GoogleAnalyticsUninstallTest extends WebTestBase {
    

    WebTestBase is deprecated. Move the tests to /tests folder and use BrowserTestBase

chr.fritsch’s picture

Status: Needs work » Needs review
FileSize
59.57 KB

Fixing all the above

chr.fritsch’s picture

Fixing the patch

Berdir’s picture

Status: Needs review » Needs work

Lets include the core_version_requirement key here with 8.7.7 as that's what the file_system calls require and also update composer.json.

With the patch I see the following remaining deprecation messages:


  67x: The \Drupal\Core\Path\AliasManager class is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Instead, use \Drupal\path_alias\AliasManager. See https://drupal.org/node/3092086
    17x in GoogleAnalyticsBasicTest::testGoogleAnalyticsTrackingCode from Drupal\Tests\google_analytics\Functional
    13x in GoogleAnalyticsRolesTest::testGoogleAnalyticsRolesTracking from Drupal\Tests\google_analytics\Functional
    12x in GoogleAnalyticsSearchTest::testGoogleAnalyticsSearchTracking from Drupal\Tests\google_analytics\Functional
    9x in GoogleAnalyticsBasicTest::testGoogleAnalyticsPageVisibility from Drupal\Tests\google_analytics\Functional
    4x in GoogleAnalyticsStatusMessagesTest::testGoogleAnalyticsStatusMessages from Drupal\Tests\google_analytics\Functional
    4x in GoogleAnalyticsUserFieldsTest::testGoogleAnalyticsUserFields from Drupal\Tests\google_analytics\Functional
    3x in GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomDimensions from Drupal\Tests\google_analytics\Functional
    3x in GoogleAnalyticsUninstallTest::testGoogleAnalyticsUninstall from Drupal\Tests\google_analytics\Functional
    2x in GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomMetrics from Drupal\Tests\google_analytics\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 GoogleAnalyticsBasicTest::testGoogleAnalyticsConfiguration from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsBasicTest::testGoogleAnalyticsHelp from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsBasicTest::testGoogleAnalyticsPageVisibility from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsBasicTest::testGoogleAnalyticsTrackingCode from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomDimensions from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomMetrics from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomDimensionsTokenFormValidation from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsPhpFilterTest::testGoogleAnalyticsPhpFilter from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsRolesTest::testGoogleAnalyticsRolesTracking from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsSearchTest::testGoogleAnalyticsSearchTracking from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsStatusMessagesTest::testGoogleAnalyticsStatusMessages from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsUninstallTest::testGoogleAnalyticsUninstall from Drupal\Tests\google_analytics\Functional
    1x in GoogleAnalyticsUserFieldsTest::testGoogleAnalyticsUserFields from Drupal\Tests\google_analytics\Functional

  2x: Global variable $pager_total_items is deprecated in drupal:8.8.0 and is removed in drupal:9.0.0. Use \Drupal\Core\Pager\PagerManagerInterface instead. See https://www.drupal.org/node/2779457
    2x in GoogleAnalyticsSearchTest::testGoogleAnalyticsSearchTracking from Drupal\Tests\google_analytics\Functional

  2x: file_scan_directory() is deprecated in drupal:8.8.0 and is removed from drupal:9.0.0. Use \Drupal\Core\File\FileSystemInterface::scanDirectory() instead. See https://www.drupal.org/node/3038437
    2x in GoogleAnalyticsUninstallTest::testGoogleAnalyticsUninstall from Drupal\Tests\google_analytics\Functional

  1x: file_unmanaged_delete() is deprecated in Drupal 8.7.0 and will be removed before Drupal 9.0.0. Use \Drupal\Core\File\FileSystemInterface::delete(). See https://www.drupal.org/node/3006851.
    1x in GoogleAnalyticsUninstallTest::testGoogleAnalyticsUninstall from Drupal\Tests\google_analytics\Functional

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

$defaultTheme is safe to add now, we can also fix that file_unmanaged_delete() and the assertFalse(), the other things should be done in a follow-up issue together with requiring 8.8.

andreyjan’s picture

Status: Needs work » Needs review
FileSize
6.55 KB
62.95 KB

- Added core_version_requirement
- Updated composer file
- Added $defaultTheme
- Replaced assertEmpty

andreyjan’s picture

Status: Needs review » Needs work

How is this test fail related to to the last changes?

Drupal\Tests\google_analytics\Functional\GoogleAnalyticsCustomDimensionsAndMetricsTest::testGoogleAnalyticsCustomDimensions
Unable to install modules google_analytics, token, node due to missing modules token.

Berdir’s picture

Maybe related to the composer.json change somehow, not sure. You could try to add it as a require-dev in comoser.json instead of test_dependencies, that's the preferred approach now anyway.

andreyjan’s picture

Status: Needs work » Needs review
FileSize
715 bytes
63.03 KB

Hopefully this fixes.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Didn't review the test changes in too much depth, but looks pretty good to me now, easier to make smaller changes later on I think.

Berdir’s picture

Status: Reviewed & tested by the community » Needs work

There's a call to path.alias_manager in _google_analytics_visibility_pages() that needs to be changed to path_alias.manager, unfortunately that means the patch also needs to require ^8.8 instead of ^8.7.7

neelam_wadhwani’s picture

Assigned: Unassigned » neelam_wadhwani
neelam_wadhwani’s picture

Assigned: neelam_wadhwani » Unassigned
Status: Needs work » Needs review
FileSize
68.31 KB
57.76 KB

Hello @Berdir
Updated patch with
_google_analytics_visibility_pages() - path_alias.manager
^8.7.7 - ^8.8

Kindly review patch.

Status: Needs review » Needs work

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

neelam_wadhwani’s picture

Fixed coding standard.

neelam_wadhwani’s picture

Status: Needs work » Needs review
Berdir’s picture

Status: Needs review » Needs work

Looks like you forgot to add the moved test files, your patch is just removing them now.

neelam_wadhwani’s picture

Hello @Berdir
Yes you were right.
I have updated patch.
KIndly review patch

neelam_wadhwani’s picture

Status: Needs work » Needs review
Berdir’s picture

Status: Needs review » Needs work

Something is still strange. The patch now only adds the new files and the interdiff is twice as big as the actual patch.

It might be easier to start again from the patch in #26 and re-apply the few first few changes from the interdiff again manually.

I can recommend my workflow, which works very well except when you need to add new files in an update/interdiff, but that's not the case here, so:

curl PATCH-URL | git apply -3
# make changes
git diff HEAD > full-patch
git diff > interdiff

Nothing else required, no branches or commits or anything.

andreyjan’s picture

Status: Needs work » Needs review
FileSize
1.92 KB
63.8 KB

Added changes per #28 review and interdiff based on #26 patch.

Berdir’s picture

Status: Needs review » Reviewed & tested by the community

Thanks.

lhridley’s picture

Rerolled patch to add new items that were deprecated with 8.8 that were not on the previous patch. Please test.

lhridley’s picture

Status: Reviewed & tested by the community » Needs review

Status: Needs review » Needs work

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

Berdir’s picture

Please provide an interdiff when working on such a large patch.

I guess you changed a scan directory call. You'll need to include a is_dir() check as the new scan function won't do that by default anymore.

lhridley’s picture

Assigned: Unassigned » lhridley
kim.pepper’s picture

Assigned: lhridley » Unassigned
Category: Plan » Task
Status: Needs work » Needs review
FileSize
63.89 KB
2.5 KB

I tried diffing the patch at #40 with #38 but there seemed to be a lot of unrelated changes.

Running drupal-check on #38 yielded

 ------ ---------------------------------------------------------------------
  Line   google_analytics.module
 ------ ---------------------------------------------------------------------
  551    Call to deprecated function file_scan_directory():
         in drupal:8.8.0 and is removed from drupal:9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::scanDirectory() instead.
 ------ ---------------------------------------------------------------------

 ------ ---------------------------------------------------------------------
  Line   tests/src/Functional/GoogleAnalyticsUninstallTest.php
 ------ ---------------------------------------------------------------------
  73     Call to deprecated function file_scan_directory():
         in drupal:8.8.0 and is removed from drupal:9.0.0.
         Use \Drupal\Core\File\FileSystemInterface::scanDirectory() instead.
 ------ ---------------------------------------------------------------------

I cleaned these up a bit. They were unnecessarily scanning all the files in the directory to delete individually when just deleting the directory should do that.

Status: Needs review » Needs work

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

kim.pepper’s picture

Status: Needs work » Needs review
FileSize
63.86 KB
1.45 KB

Ooops. I meant to use deleteRecursive().

kim.pepper’s picture

Title: Drupal 9 compatibility related issues should be fixed. » Add Drupal 9 compatibility

Updating the title.

kim.pepper’s picture

shobhit_juyal’s picture

#47 works for me

Chris Matthews’s picture

Just curious, why does the project page currently state "Google Analytics 8.x-2.5+ supports Drupal 9", when this issue is still active?

Google Analytics D9

And from the Upgrade Status module:
Upgrade Status Module Report

jcnventura’s picture

Status: Needs review » Needs work

Indeed, not easy to review. But on the first lines, this module's composer.json states:

"drupal/core": "^8.7.7 || ^9"

While the .info.yml states:

core_version_requirement: ^8.8 || ^9

The best way to avoid this information being out of sync is to trust the d.o packager to correctly fill this info in composer.json from the information on the .info.yml file. As such, please remove the drupal/core requirement from the composer.json file completely.

jcnventura’s picture

Fixing the composer.json <-> google_analytics.info.yml inconsistency by removing the drupal/core requirement from composer.json as stated by the core_version_requirement CR:

It is also possible to specify the same requirement in composer.json, but if no drupal/core requirement is defined there, one will automatically be generated based on core_version_requirement. This has been implemented in #3084063: Use information in info.yml files to determine project requirements.

Also removing the core_version_requirement from the test module as according to the same CR:

Note that test modules (Package: Testing) can omit the core_version_requirement key entirely as of Drupal 8.8.2, so that they will work with any core version they are tested against.

jcnventura’s picture

@Chris Matthews I think the answer to your question is the fact that currently there is NO google_analytics 8.x-2.5 yet.

komalk’s picture

e.bogatyrev’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +epam-contrib

Hi there,

Tested patch #53 on Drupal 8.8. Looks good

drupal-check google_analytics/
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

[OK] No errors

  • japerry committed 841b0a6 on 8.x-2.x
    Issue #3072207 by thalles, japerry, pranit84, andreyjan, neelam_wadhwani...
japerry’s picture

Status: Reviewed & tested by the community » Fixed

Thanks everyone for your work on this. the 2.x branch is now D9 compatible!

naveenvalecha’s picture

@japerry
Can you cherry-pick this to 3.x?

Berdir’s picture

There's apparently a separate issue for 8.x-3.x, I'm not quite sure why :)

naveenvalecha’s picture

Thanks! @berdir

Status: Fixed » Closed (fixed)

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

DamienMcKenna’s picture

Title: Add Drupal 9 compatibility » Drupal 9 compatibility for Google Analytics