function NodeImportCreateTest::testImportCreateDefault

Same name and namespace in other branches
  1. 9 core/modules/node/tests/src/Kernel/Config/NodeImportCreateTest.php \Drupal\Tests\node\Kernel\Config\NodeImportCreateTest::testImportCreateDefault()
  2. 10 core/modules/node/tests/src/Kernel/Config/NodeImportCreateTest.php \Drupal\Tests\node\Kernel\Config\NodeImportCreateTest::testImportCreateDefault()
  3. 11.x core/modules/node/tests/src/Kernel/Config/NodeImportCreateTest.php \Drupal\Tests\node\Kernel\Config\NodeImportCreateTest::testImportCreateDefault()

Tests creating a content type during default config import.

File

core/modules/node/tests/src/Kernel/Config/NodeImportCreateTest.php, line 38

Class

NodeImportCreateTest
Create content types during config create method invocation.

Namespace

Drupal\Tests\node\Kernel\Config

Code

public function testImportCreateDefault() {
    $node_type_id = 'default';
    // Check that the content type does not exist yet.
    $this->assertNull(NodeType::load($node_type_id));
    // Enable node_test_config module and check that the content type
    // shipped in the module's default config is created.
    $this->container
        ->get('module_installer')
        ->install([
        'node_test_config',
    ]);
    $node_type = NodeType::load($node_type_id);
    $this->assertNotEmpty($node_type, 'The default content type was created.');
}

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