public function UninstallTest::testUninstall in Node Option Premium 8
Tests module uninstallation.
File
- tests/
src/ Functional/ UninstallTest.php, line 59
Class
- UninstallTest
- Tests module uninstallation.
Namespace
Drupal\Tests\nopremium\FunctionalCode
public function testUninstall() {
// Confirm that the Node Option Premium module has been installed.
$this
->assertTrue($this->moduleHandler
->moduleExists('nopremium'));
// Create a content type.
$this
->drupalCreateContentType([
'type' => 'foo',
]);
// Set default value for premium to "TRUE" for this content type.
$fields = $this->container
->get('entity_field.manager')
->getFieldDefinitions('node', 'foo');
$fields['premium']
->getConfig('foo')
->setDefaultValue(TRUE)
->save();
// The config ID that is expected to exist now.
$config_id = 'core.base_field_override.node.foo.premium';
// Assert that base_field_override config was created.
$this
->assertTrue($this->container
->get('config.storage')
->exists($config_id), "Config {$config_id} has been created.");
// Uninstall Node Option Premium.
$this->moduleInstaller
->uninstall([
'nopremium',
]);
$this
->assertFalse($this->moduleHandler
->moduleExists('nopremium'));
// Assert that config is cleaned up as well.
$this
->assertFalse($this->container
->get('config.storage')
->exists($config_id), "Config {$config_id} no longer exists.");
}