Commit 40e01912 authored by Gábor Hojtsy's avatar Gábor Hojtsy
Browse files

Issue #3260292 by Gábor Hojtsy: Fix tests: obsolete module detection cannot be...

Issue #3260292 by Gábor Hojtsy: Fix tests: obsolete module detection cannot be tested because now Drupal blocks enabling obsolete modules; Drupal 9.3.0's release necessitated mock deprecation changes for categorization accuracy
parent 10590646
Loading
Loading
Loading
Loading
+2 −2
Changes for tests/modules/upgrade_status_test_contrib_error/upgrade_status_test_contrib_error.module: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -23,11 +23,11 @@ function upgrade_status_test_contrib_error_function_8_to_10() {
/**
 * Tests function deprecation detection from Drupal 9 to 10.
 *
 * @deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use the
 * @deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use the
 *   replacement instead.
 */
function upgrade_status_test_contrib_error_function_9_to_10() {
  @trigger_error("upgrade_status_test_contrib_error_function_9_to_10() is deprecated in Drupal 9.2.0 and will be removed before Drupal 10.0.0. Use the replacement instead. See LINK", E_USER_DEPRECATED);
  @trigger_error("upgrade_status_test_contrib_error_function_9_to_10() is deprecated in Drupal 9.4.0 and will be removed before Drupal 10.0.0. Use the replacement instead. See LINK", E_USER_DEPRECATED);
}

/**
+0 −8
Changes for tests/modules/upgrade_status_test_obsolete/upgrade_status_test_obsolete.info.yml: 0 added lines, 8 removed lines.
Original line number Diff line number Diff line
name: 'Upgrade status test obsolete'
type: module
description: 'Support module for upgrade status module testing.'
package: Testing
version: VERSION
core_version_requirement: ^8 || ^9 || ^10
lifecycle: obsolete
lifecycle_link: https://drupal.org/project/upgrade_status
+1 −9
Changes for tests/src/Functional/UpgradeStatusAnalyzeTest.php: 1 added line, 9 removed lines.
Original line number Diff line number Diff line
@@ -28,7 +28,6 @@ class UpgradeStatusAnalyzeTest extends UpgradeStatusTestBase {
    $this->assertTrue($key_value->has('upgrade_status_test_theme'));
    $this->assertTrue($key_value->has('upgrade_status_test_library'));
    $this->assertTrue($key_value->has('upgrade_status_test_deprecated'));
    $this->assertTrue($key_value->has('upgrade_status_test_obsolete'));

    // The project upgrade_status_test_submodules_a shouldn't have scan result,
    // because it's a submodule of 'upgrade_status_test_submodules',
@@ -109,7 +108,7 @@ class UpgradeStatusAnalyzeTest extends UpgradeStatusTestBase {
    $this->assertEquals(14, $message['line']);
    $this->assertEquals($this->getDrupalCoreMajorVersion() < 9 ? 'ignore' : 'old', $message['upgrade_status_category']);
    $message = $file['messages'][2];
    $this->assertEquals("Call to deprecated function upgrade_status_test_contrib_error_function_9_to_10(). Deprecated in drupal:9.2.0 and is removed from drupal:10.0.0. Use the replacement instead.", $message['message']);
    $this->assertEquals("Call to deprecated function upgrade_status_test_contrib_error_function_9_to_10(). Deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Use the replacement instead.", $message['message']);
    $this->assertEquals(15, $message['line']);
    $this->assertEquals($this->getDrupalCoreMajorVersion() < 9 ? 'ignore' : 'later', $message['upgrade_status_category']);
    $message = $file['messages'][3];
@@ -222,13 +221,6 @@ class UpgradeStatusAnalyzeTest extends UpgradeStatusTestBase {
    $this->assertCount(1, $report['data']['files']);
    $file = reset($report['data']['files']);
    $this->assertEquals("This extension is deprecated. Don't use it. See https://drupal.org/project/upgrade_status.", $file['messages'][0]['message']);

    $report = $key_value->get('upgrade_status_test_obsolete');
    $this->assertNotEmpty($report);
    $this->assertEquals(1, $report['data']['totals']['file_errors']);
    $this->assertCount(1, $report['data']['files']);
    $file = reset($report['data']['files']);
    $this->assertEquals("This extension is obsolete. Obsolete extensions are usually uninstalled automatically when not needed anymore. You only need to do something about this if the uninstallation was unsuccesful. See https://drupal.org/project/upgrade_status.", $file['messages'][0]['message']);
  }

}
+0 −2
Changes for tests/src/Functional/UpgradeStatusTestBase.php: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ abstract class UpgradeStatusTestBase extends BrowserTestBase {
    'upgrade_status_test_library',
    'upgrade_status_test_library_exception',
    'upgrade_status_test_deprecated',
    'upgrade_status_test_obsolete',
  ];

  /**
@@ -59,7 +58,6 @@ abstract class UpgradeStatusTestBase extends BrowserTestBase {
      'scan[data][list][upgrade_status_test_library]' => TRUE,
      'scan[data][list][upgrade_status_test_library_exception]' => TRUE,
      'scan[data][list][upgrade_status_test_deprecated]' => TRUE,
      'scan[data][list][upgrade_status_test_obsolete]' => TRUE,
      'collaborate[data][list][upgrade_status_test_contrib_error]' => TRUE,
      ($this->getDrupalCoreMajorVersion() < 9 ? 'relax' : 'collaborate') . '[data][list][upgrade_status]' => TRUE,
      ($this->getDrupalCoreMajorVersion() < 9 ? 'relax' : 'collaborate') . '[data][list][upgrade_status_test_contrib_9_compatible]' => TRUE,