function ThirdPartyUninstallTest::testThirdPartyUninstall

Tests removing third-party settings when a provider module is uninstalled.

File

core/modules/views/tests/src/Kernel/ThirdPartyUninstallTest.php, line 41

Class

ThirdPartyUninstallTest
Tests proper removal of third-party settings from views.

Namespace

Drupal\Tests\views\Kernel

Code

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'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.