function NodeTypeExampleTest::testUninstallReinstall

Same name in other branches
  1. 4.0.x modules/node_type_example/tests/src/Functional/NodeTypeExampleTest.php \Drupal\Tests\node_type_example\Functional\NodeTypeExampleTest::testUninstallReinstall()

Verify that user can uninstall and then reinstall node_type_example.

File

modules/node_type_example/tests/src/Functional/NodeTypeExampleTest.php, line 172

Class

NodeTypeExampleTest
Test that our content types are successfully created.

Namespace

Drupal\Tests\node_type_example\Functional

Code

public function testUninstallReinstall() {
    $session = $this->assertSession();
    // Uninstalling module.
    $module_installer = $this->container
        ->get('module_installer');
    $module_installer->uninstall([
        'node_type_example',
    ]);
    $this->drupalGet('examples/node-type-example');
    $session->statusCodeEquals(404);
    // Re-installing module.
    $module_installer->install([
        'node_type_example',
    ]);
    $this->drupalGet('examples/node-type-example');
    $session->statusCodeEquals(200);
}