You are here

public function NodeImportCreateTest::testImportCreateDefault in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/node/tests/src/Kernel/Config/NodeImportCreateTest.php \Drupal\Tests\node\Kernel\Config\NodeImportCreateTest::testImportCreateDefault()
  2. 9 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.');
}