Skip to content
Snippets Groups Projects
Commit db6ddf92 authored by catch's avatar catch
Browse files

Issue #3496867 by dcam, drunken monkey, smustgrave, nicxvan: Uninstalling a...

Issue #3496867 by dcam, drunken monkey, smustgrave, nicxvan: Uninstalling a module deletes all views that have third-party settings by that module
parent b633101e
No related branches found
No related tags found
5 merge requests!12873Fix an TypeError on StatementWrapperIterator that occurs at the end of running phpunit,!12628#3524738 backport without deprecation,!5423Draft: Resolve #3329907 "Test2",!3478Issue #3337882: Deleted menus are not removed from content type config,!213Issue #2906496: Give Media a menu item under Content
Pipeline #498703 passed with warnings
Pipeline: drupal

#498722

    Pipeline: drupal

    #498715

      Pipeline: drupal

      #498706

        ......@@ -481,7 +481,7 @@ public function invalidateCaches() {
        * {@inheritdoc}
        */
        public function onDependencyRemoval(array $dependencies) {
        $changed = FALSE;
        $changed = parent::onDependencyRemoval($dependencies);
        // Don't intervene if the views module is removed.
        if (isset($dependencies['module']) && in_array('views', $dependencies['module'])) {
        ......
        ......
        langcode: en
        status: true
        dependencies:
        module:
        - node
        - views_third_party_settings_test
        third_party_settings:
        views_third_party_settings_test:
        example_setting: true
        id: test_third_party_uninstall
        label: test_third_party_uninstall
        module: views
        description: ''
        tag: ''
        base_table: node_field_data
        base_field: nid
        display:
        default:
        display_options:
        access:
        type: none
        cache:
        type: tag
        exposed_form:
        type: basic
        pager:
        type: full
        query:
        type: views_query
        style:
        type: default
        row:
        type: fields
        display_plugin: default
        display_title: Defaults
        id: default
        position: 0
        views.view.*.third_party.views_third_party_settings_test:
        type: config_entity
        label: "Example settings"
        mapping:
        example_setting:
        type: boolean
        label: "Example setting"
        name: 'Third Party Settings Test'
        type: module
        description: 'A dummy module that third party settings tests can depend on'
        package: Testing
        version: VERSION
        dependencies:
        - drupal:node
        - drupal:views
        <?php
        declare(strict_types=1);
        namespace Drupal\Tests\views\Kernel;
        use Drupal\views\Entity\View;
        /**
        * Tests proper removal of third-party settings from views.
        *
        * @group views
        */
        class ThirdPartyUninstallTest extends ViewsKernelTestBase {
        /**
        * {@inheritdoc}
        */
        protected static $modules = ['node', 'views_third_party_settings_test'];
        /**
        * Views used by this test.
        *
        * @var array
        */
        public static $testViews = ['test_third_party_uninstall'];
        /**
        * {@inheritdoc}
        */
        protected function setUp($import_test_views = TRUE): void {
        parent::setUp($import_test_views);
        $this->installEntitySchema('user');
        $this->installSchema('user', ['users_data']);
        }
        /**
        * Tests removing third-party settings when a provider module is uninstalled.
        */
        public function testThirdPartyUninstall(): void {
        $view = View::load('test_third_party_uninstall');
        $this->assertNotEmpty($view);
        $this->assertContains('views_third_party_settings_test', $view->getDependencies()['module']);
        $this->assertTrue($view->getThirdPartySetting('views_third_party_settings_test', 'example_setting'));
        \Drupal::service('module_installer')->uninstall(['views_third_party_settings_test']);
        $view = View::load('test_third_party_uninstall');
        $this->assertNotEmpty($view);
        $this->assertNotContains('views_third_party_settings_test', $view->getDependencies()['module']);
        $this->assertNull($view->getThirdPartySetting('views_third_party_settings_test', 'example_setting'));
        }
        }
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please to comment