class MappingTest

Same name in this branch
  1. main core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest
Same name and namespace in other branches
  1. 11.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest
  2. 11.x core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php \Drupal\KernelTests\Config\Schema\MappingTest
  3. 10 core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest
  4. 10 core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php \Drupal\KernelTests\Config\Schema\MappingTest
  5. 9 core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest
  6. 8.9.x core/modules/views/tests/modules/views_test_data/src/Plugin/views/style/MappingTest.php \Drupal\views_test_data\Plugin\views\style\MappingTest

Tests Drupal\Core\Config\Schema\Mapping.

Attributes

#[CoversClass(Mapping::class)] #[Group('Config')] #[RunTestsInSeparateProcesses]

Hierarchy

Expanded class hierarchy of MappingTest

File

core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php, line 24

Namespace

Drupal\KernelTests\Config\Schema
View source
class MappingTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static array $configSchemaCheckerExclusions = [
    'config_schema_deprecated_test.settings',
  ];
  
  /**
   * Tests mapping interpretation.
   */
  public function testMappingInterpretation(string $config_name, ?string $property_path, array $expected_valid_keys, array $expected_optional_keys, array $expected_dynamically_valid_keys) : void {
    // Some config needs some dependencies installed.
    switch ($config_name) {
      case 'block.block.branding':
        $this->enableModules([
          'system',
          'block',
        ]);
        /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
        $theme_installer = $this->container
          ->get('theme_installer');
        $theme_installer->install([
          'stark',
        ]);
        Block::create([
          'id' => 'branding',
          'plugin' => 'system_branding_block',
          'theme' => 'stark',
          'status' => TRUE,
          'settings' => [
            'use_site_logo' => TRUE,
            'use_site_name' => TRUE,
            'use_site_slogan' => TRUE,
            'label_display' => '0',
            // This is inherited from `type: block_settings`.
'context_mapping' => [],
          ],
        ])->save();
        break;

      case 'block.block.local_tasks':
        $this->enableModules([
          'system',
          'block',
        ]);
        /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
        $theme_installer = $this->container
          ->get('theme_installer');
        $theme_installer->install([
          'stark',
        ]);
        Block::create([
          'id' => 'local_tasks',
          'plugin' => 'local_tasks_block',
          'theme' => 'stark',
          'status' => TRUE,
          'settings' => [
            'primary' => TRUE,
            'secondary' => FALSE,
            // This is inherited from `type: block_settings`.
'context_mapping' => [],
          ],
        ])->save();
        break;

      case 'block.block.positively_powered___alternate_reality_with_fallback_type___':
        $this->enableModules([
          'config_schema_add_fallback_type_test',
        ]);
        $id = 'positively_powered___alternate_reality_with_fallback_type___';
      case 'block.block.positively_powered':
        $this->enableModules([
          'system',
          'block',
        ]);
        /** @var \Drupal\Core\Extension\ThemeInstallerInterface $theme_installer */
        $theme_installer = $this->container
          ->get('theme_installer');
        $theme_installer->install([
          'stark',
        ]);
        Block::create([
          'id' => $id ?? 'positively_powered',
          'plugin' => 'system_powered_by_block',
          'theme' => 'stark',
          'status' => TRUE,
          'settings' => [
            'label_display' => '0',
            // This is inherited from `type: block_settings`.
'context_mapping' => [],
          ],
          // Avoid showing "Powered by Drupal" on 404 responses.
'visibility' => [
            'I_CAN_CHOOSE_THIS' => [
              'id' => 'response_status',
              'negate' => FALSE,
              'status_codes' => [
                404,
              ],
            ],
          ],
        ])->save();
        break;

      case 'config_schema_deprecated_test.settings':
        $this->enableModules([
          'config_schema_deprecated_test',
        ]);
        $config = $this->config('config_schema_deprecated_test.settings');
        // @see \Drupal\KernelTests\Core\Config\ConfigSchemaDeprecationTest
        $config->set('complex_structure_deprecated.type', 'fruits')
          ->set('complex_structure_deprecated.products', [
          'apricot',
          'apple',
        ])
          ->save();
        break;

      case 'editor.editor.funky':
        $this->enableModules([
          'filter',
          'editor',
          'ckeditor5',
        ]);
        FilterFormat::create([
          'format' => 'funky',
          'name' => 'Funky',
        ])->save();
        Editor::create([
          'format' => 'funky',
          'editor' => 'ckeditor5',
          'image_upload' => [
            'status' => FALSE,
          ],
        ])->save();
        break;

      case 'field.field.node.config_mapping_test.comment_config_mapping_test':
        $this->enableModules([
          'user',
          'field',
          'node',
          'comment',
          'taxonomy',
          'config_mapping_test',
        ]);
        $this->installEntitySchema('user');
        $this->installEntitySchema('node');
        $this->assertNull(FieldConfig::load('node.config_mapping_test.comment_config_mapping_test'));
        $this->installConfig([
          'config_mapping_test',
        ]);
        $this->assertNotNull(FieldConfig::load('node.config_mapping_test.comment_config_mapping_test'));
        break;

    }
    /** @var \Drupal\Core\Config\TypedConfigManagerInterface $typed_config_manager */
    $typed_config_manager = \Drupal::service('config.typed');
    $mapping = $typed_config_manager->get($config_name);
    if ($property_path) {
      $mapping = $mapping->get($property_path);
    }
    assert($mapping instanceof Mapping);
    $expected_required_keys = array_values(array_diff($expected_valid_keys, $expected_optional_keys));
    $this->assertSame($expected_valid_keys, $mapping->getValidKeys());
    $this->assertSame($expected_required_keys, $mapping->getRequiredKeys());
    $this->assertSame($expected_dynamically_valid_keys, $mapping->getDynamicallyValidKeys());
    $this->assertSame($expected_optional_keys, $mapping->getOptionalKeys());
  }
  
  /**
   * Provides test cases for all kinds of i) dynamic typing, ii) optional keys.
   *
   * @see https://www.drupal.org/files/ConfigSchemaCheatSheet2.0.pdf
   *
   * @return \Generator
   *   The test cases.
   */
  public static function providerMappingInterpretation() : \Generator {
    $available_block_settings_types = [
      'block.settings.field_block:*:*:*' => [
        'formatter',
      ],
      'block.settings.extra_field_block:*:*:*' => [
        'formatter',
      ],
      'block.settings.system_branding_block' => [
        'use_site_logo',
        'use_site_name',
        'use_site_slogan',
      ],
      'block.settings.system_menu_block:*' => [
        'level',
        'depth',
        'expand_all_items',
        'ignore_active_trail',
      ],
      'block.settings.local_tasks_block' => [
        'primary',
        'secondary',
      ],
    ];
    // A simple config often is just a single Mapping object.
    yield 'No dynamic type: core.extension' => [
      'core.extension',
      NULL,
      [
        // Keys inherited from `type: config_object`.
        // @see core/config/schema/core.data_types.schema.yml
'_core',
        'langcode',
        // Keys defined locally, in `type: core.extension`.
        // @see core/config/schema/core.extension.schema.yml
'module',
        'theme',
        'profile',
      ],
      [
        '_core',
        'langcode',
        'profile',
      ],
      [],
    ];
    // Special case: deprecated  is needed for deprecated config schema:
    // - deprecated keys are treated as optional
    // - if a deprecated property path is itself a mapping, then the keys inside
    //   are not optional.
    yield 'No dynamic type: config_schema_deprecated_test.settings' => [
      'config_schema_deprecated_test.settings',
      NULL,
      [
        // Keys inherited from `type: config_object`.
        // @see core/config/schema/core.data_types.schema.yml
'_core',
        'langcode',
        // Keys defined locally, in `type:
        // config_schema_deprecated_test.settings`.
        // @see core/modules/config/tests/config_schema_deprecated_test/config/schema/config_schema_deprecated_test.schema.yml
'complex_structure_deprecated',
      ],
      [
        '_core',
        'langcode',
        'complex_structure_deprecated',
      ],
      [],
    ];
    yield 'No dynamic type: config_schema_deprecated_test.settings:complex_structure_deprecated' => [
      'config_schema_deprecated_test.settings',
      'complex_structure_deprecated',
      [
        // Keys defined locally, in `type:
        // config_schema_deprecated_test.settings`.
        // @see core/modules/config/tests/config_schema_deprecated_test/config/schema/config_schema_deprecated_test.schema.yml
'type',
        'products',
      ],
      [],
      [],
    ];
    // A config entity is always a Mapping at the top level, but most nesting is
    // also using Mappings (unless the keys are free to be chosen, then a
    // Sequence would be used).
    yield 'No dynamic type: block.block.branding' => [
      'block.block.branding',
      NULL,
      [
        // Keys inherited from `type: config_entity`.
        // @see core/config/schema/core.data_types.schema.yml
'uuid',
        'langcode',
        'status',
        'dependencies',
        'third_party_settings',
        '_core',
        // Keys defined locally, in `type: block.block.*`.
        // @see core/modules/block/config/schema/block.schema.yml
'id',
        'theme',
        'region',
        'weight',
        'provider',
        'plugin',
        'settings',
        'visibility',
      ],
      [
        'third_party_settings',
        '_core',
      ],
      [],
    ];
    // An example of nested Mapping objects in config entities.
    yield 'No dynamic type: block.block.branding:dependencies' => [
      'block.block.branding',
      'dependencies',
      [
        // Keys inherited from `type: config_dependencies_base`.
        // @see core/config/schema/core.data_types.schema.yml
'config',
        'content',
        'module',
        'theme',
        // Keys defined locally, in `type: config_dependencies`.
        // @see core/config/schema/core.data_types.schema.yml
'enforced',
      ],
      // All these keys are optional!
[
        'config',
        'content',
        'module',
        'theme',
        'enforced',
      ],
      [],
    ];
    // Three examples of `[%parent]`-based dynamic typing in config schema, and
    // the consequences on what keys are considered valid: the first 2 depend
    // on the block plugin being used using a single `%parent`, the third
    // depends on the field plugin being used using a double `%parent`.
    // See `type: block.block.*` which uses
    // `type: block.settings.[%parent.plugin]`, and `type: field_config_base`
    // which uses `type: field.value.[%parent.%parent.field_type]`.
    yield 'Dynamic type with [%parent]: block.block.branding:settings' => [
      'block.block.branding',
      'settings',
      [
        // Keys inherited from `type: block.settings.*`, which in turn is
        // inherited from `type: block_settings`.
        // @see core/config/schema/core.data_types.schema.yml
'id',
        'label',
        'label_display',
        'provider',
        'context_mapping',
        // Keys defined locally, in `type:
        // block.settings.system_branding_block`.
        // @see core/modules/block/config/schema/block.schema.yml
$available_block_settings_types['block.settings.system_branding_block'],
      ],
      // This key is optional, see `type: block_settings`.
      // @see core.data_types.schema.yml
[
        'context_mapping',
      ],
      $available_block_settings_types,
    ];
    yield 'Dynamic type with [%parent]: block.block.local_tasks:settings' => [
      'block.block.local_tasks',
      'settings',
      [
        // Keys inherited from `type: block.settings.*`, which in turn is
        // inherited from `type: block_settings`.
        // @see core/config/schema/core.data_types.schema.yml
'id',
        'label',
        'label_display',
        'provider',
        'context_mapping',
        // Keys defined locally, in `type: block.settings.local_tasks_block`.
        // @see core/modules/system/config/schema/system.schema.yml
$available_block_settings_types['block.settings.local_tasks_block'],
      ],
      // This key is optional, see `type: block_settings`.
      // @see core.data_types.schema.yml
[
        'context_mapping',
      ],
      $available_block_settings_types,
    ];
    yield 'Dynamic type with [%parent.%parent]: field.field.node.config_mapping_test.comment_config_mapping_test:default_value.0' => [
      'field.field.node.config_mapping_test.comment_config_mapping_test',
      'default_value.0',
      [
        // Keys defined locally, in `type: field.value.comment`.
        // @see core/modules/comment/config/schema/comment.schema.yml
'status',
        'cid',
        'last_comment_timestamp',
        'last_comment_name',
        'last_comment_uid',
        'comment_count',
      ],
      [],
      [
        'field.value.string' => [
          'value',
        ],
        'field.value.string_long' => [
          'value',
        ],
        'field.value.uri' => [
          'value',
        ],
        'field.value.created' => [
          'value',
        ],
        'field.value.changed' => [
          'value',
        ],
        'field.value.entity_reference' => [
          'target_id',
          'target_uuid',
        ],
        'field.value.boolean' => [
          'value',
        ],
        'field.value.email' => [
          'value',
        ],
        'field.value.integer' => [
          'value',
        ],
        'field.value.decimal' => [
          'value',
        ],
        'field.value.float' => [
          'value',
        ],
        'field.value.timestamp' => [
          'value',
        ],
        'field.value.language' => [
          'value',
        ],
        'field.value.comment' => [
          'status',
          'cid',
          'last_comment_timestamp',
          'last_comment_name',
          'last_comment_uid',
          'comment_count',
        ],
      ],
    ];
    // An example of `[childkey]`-based dynamic mapping typing in config schema,
    // for a mapping inside a sequence: the `id` key-value pair in the mapping
    // determines the type of the mapping. The key in the sequence whose value
    // is the mapping is irrelevant, it can be arbitrarily chosen.
    // See `type: block.block.*` which uses `type: condition.plugin.[id]`.
    yield 'Dynamic type with [childkey]: block.block.positively_powered:visibility.I_CAN_CHOOSE_THIS' => [
      'block.block.positively_powered',
      'visibility.I_CAN_CHOOSE_THIS',
      [
        // Keys inherited from `type: condition.plugin`.
        // @see core/config/schema/core.data_types.schema.yml
'id',
        'negate',
        'context_mapping',
        // Keys defined locally, in `type: condition.plugin.response_status`.
        // @see core/modules/system/config/schema/system.schema.yml
'status_codes',
      ],
      // This key is optional, see `type: condition.plugin`.
      // @see core.data_types.schema.yml
[
        'context_mapping',
      ],
      // Note the presence of `id`, `negate`, and `context_mapping` here.
      // That's because there is no `condition.plugin.*` type that specifies
      // defaults. Each individual condition plugin has the freedom to deviate
      // from this approach!
[
        'condition.plugin.entity_bundle:*' => [
          'id',
          'negate',
          'context_mapping',
          'bundles',
        ],
        'condition.plugin.request_path' => [
          'id',
          'negate',
          'context_mapping',
          'pages',
        ],
        'condition.plugin.response_status' => [
          'id',
          'negate',
          'context_mapping',
          'status_codes',
        ],
        'condition.plugin.current_theme' => [
          'id',
          'negate',
          'context_mapping',
          'theme',
        ],
      ],
    ];
    // Same, but what if `type: condition.plugin.*` would have existed?
    // @see core/modules/config/tests/config_schema_add_fallback_type_test/config/schema/config_schema_add_fallback_type_test.schema.yml
    yield 'Dynamic type with [childkey]: block.block.positively_powered___alternate_reality_with_fallback_type___:visibility' => [
      'block.block.positively_powered___alternate_reality_with_fallback_type___',
      'visibility.I_CAN_CHOOSE_THIS',
      [
        // Keys inherited from `type: condition.plugin`.
        // @see core/config/schema/core.data_types.schema.yml
'id',
        'negate',
        'context_mapping',
        // Keys defined locally, in `type: condition.plugin.response_status`.
        // @see core/modules/system/config/schema/system.schema.yml
'status_codes',
      ],
      // This key is optional, see `type: condition.plugin`.
      // @see core.data_types.schema.yml
[
        'context_mapping',
      ],
      // Note the ABSENCE of `id`, `negate`, and `context_mapping`
      // compared to the previous test case, because now the
      // `condition.plugin.*` type does exist.
[
        'condition.plugin.entity_bundle:*' => [
          'bundles',
        ],
        'condition.plugin.request_path' => [
          'pages',
        ],
        'condition.plugin.response_status' => [
          'status_codes',
        ],
        'condition.plugin.current_theme' => [
          'theme',
        ],
      ],
    ];
    // An example of `[%key]`-based dynamic mapping typing in config schema: the
    // key in the sequence determines the type of the mapping. Unlike the above
    // `[childkey]` example, the key has meaning here.
    // See `type: editor.settings.ckeditor5`, which uses
    // `type: ckeditor5.plugin.[%key]`.
    yield 'Dynamic type with [%key]: editor.editor.funky:settings.plugins.ckeditor5_heading' => [
      'editor.editor.funky',
      'settings.plugins.ckeditor5_heading',
      [
        // Keys defined locally, in `type: ckeditor5.plugin.ckeditor5_heading`.
        // @see core/modules/ckeditor5/config/schema/ckeditor5.schema.yml
'enabled_headings',
      ],
      [],
      [
        'ckeditor5.plugin.ckeditor5_language' => [
          'language_list',
        ],
        'ckeditor5.plugin.ckeditor5_heading' => [
          'enabled_headings',
        ],
        'ckeditor5.plugin.ckeditor5_imageResize' => [
          'allow_resize',
        ],
        'ckeditor5.plugin.ckeditor5_sourceEditing' => [
          'allowed_tags',
        ],
        'ckeditor5.plugin.ckeditor5_alignment' => [
          'enabled_alignments',
        ],
        'ckeditor5.plugin.ckeditor5_list' => [
          'properties',
          'multiBlock',
        ],
        'ckeditor5.plugin.media_media' => [
          'allow_view_mode_override',
        ],
        'ckeditor5.plugin.ckeditor5_codeBlock' => [
          'languages',
        ],
        'ckeditor5.plugin.ckeditor5_style' => [
          'styles',
        ],
      ],
    ];
  }
  
  /**
   * Tests invalid mapping key definition.
   */
  // phpcs:disable Drupal.Arrays.Array.LongLineDeclaration
  public function testInvalidMappingKeyDefinition(bool $has_parent, mixed $invalid_key_definition, string $expected_message) : void {
    $definition = new MapDataDefinition([
      'type' => 'mapping',
      'mapping' => [
        'valid' => [
          'type' => 'boolean',
          'label' => 'This is a valid key-value pair in this mapping',
        ],
        'invalid' => $invalid_key_definition,
      ],
    ]);
    $parent = NULL;
    if ($has_parent) {
      $parent = new Mapping(new MapDataDefinition([
        'type' => 'mapping',
        'mapping' => [],
      ]), 'my_module.settings');
    }
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage($expected_message);
    new Mapping($definition, 'foobar', $parent);
  }
  
  /**
   * Tests invalid required key flag.
   */
  public function testInvalidRequiredKeyFlag(mixed $required_key_flag_value) : void {
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('The `requiredKey` flag must either be omitted or have `false` as the value.');
    new Mapping(new MapDataDefinition([
      'type' => 'mapping',
      'mapping' => [
        'something' => [
          'requiredKey' => $required_key_flag_value,
        ],
      ],
    ]));
  }

}

Members

Title Sort descending Deprecated Modifiers Object type Summary Overriden Title Overrides
AssertContentTrait::$content protected property The current raw content.
AssertContentTrait::$drupalSettings protected property The drupalSettings value from the current raw $content.
AssertContentTrait::$elements protected property The XML structure parsed from the current raw $content.
AssertContentTrait::$plainTextContent protected property The plain-text content of raw $content (text nodes).
AssertContentTrait::assertEscaped protected function Passes if the raw text IS found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertField protected function Asserts that a field exists with the given name or ID.
AssertContentTrait::assertFieldByName protected function Asserts that a field exists with the given name and value.
AssertContentTrait::assertFieldByXPath protected function Asserts that a field exists in the current page by the given XPath.
AssertContentTrait::assertFieldsByValue protected function Asserts that a field exists in the current page with a given Xpath result.
AssertContentTrait::assertLink protected function Passes if a link with the specified label is found.
AssertContentTrait::assertLinkByHref protected function Passes if a link containing a given href (part) is found.
AssertContentTrait::assertNoLink protected function Passes if a link with the specified label is not found.
AssertContentTrait::assertNoPattern protected function Triggers a pass if the perl regex pattern is not found in raw content.
AssertContentTrait::assertNoRaw protected function Passes if the raw text is NOT found on the loaded page, fail otherwise.
AssertContentTrait::assertNoText protected function Passes if the page (with HTML stripped) does not contains the text.
AssertContentTrait::assertPattern protected function Triggers a pass if the Perl regex pattern is found in the raw content.
AssertContentTrait::assertRaw protected function Passes if the raw text IS found on the loaded page, fail otherwise.
AssertContentTrait::assertText protected function Passes if the page (with HTML stripped) contains the text.
AssertContentTrait::assertTextHelper protected function Helper for assertText and assertNoText.
AssertContentTrait::assertThemeOutput protected function Asserts themed output.
AssertContentTrait::assertTitle protected function Pass if the page title is the given string.
AssertContentTrait::buildXPathQuery protected function Builds an XPath query.
AssertContentTrait::constructFieldXpath protected function Helper: Constructs an XPath for the given set of attributes and value.
AssertContentTrait::cssSelect protected function Searches elements using a CSS selector in the raw content.
AssertContentTrait::getAllOptions protected function Get all option elements, including nested options, in a select.
AssertContentTrait::getDrupalSettings protected function Gets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::getRawContent protected function Gets the current raw content.
AssertContentTrait::getSelectedItem protected function Get the selected value from a select field.
AssertContentTrait::getTextContent protected function Retrieves the plain-text content from the current raw content.
AssertContentTrait::parse protected function Parse content returned from curlExec using DOM and SimpleXML.
AssertContentTrait::removeWhiteSpace protected function Removes all white-space between HTML tags from the raw content.
AssertContentTrait::setDrupalSettings protected function Sets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::setRawContent protected function Sets the raw content (e.g. HTML).
AssertContentTrait::xpath protected function Performs an xpath search on the contents of the internal browser.
BrowserHtmlDebugTrait::$htmlOutputBaseUrl protected property The Base URI to use for links to the output files.
BrowserHtmlDebugTrait::$htmlOutputClassName protected property Class name for HTML output logging.
BrowserHtmlDebugTrait::$htmlOutputCounter protected property Counter for HTML output logging.
BrowserHtmlDebugTrait::$htmlOutputCounterStorage protected property Counter storage for HTML output logging.
BrowserHtmlDebugTrait::$htmlOutputDirectory protected property Directory name for HTML output logging.
BrowserHtmlDebugTrait::$htmlOutputEnabled protected property HTML output enabled.
BrowserHtmlDebugTrait::$htmlOutputTestId protected property HTML output test ID.
BrowserHtmlDebugTrait::formatHtmlOutputHeaders protected function Formats HTTP headers as string for HTML output logging.
BrowserHtmlDebugTrait::getHtmlOutputHeaders protected function Returns headers in HTML output format. 1
BrowserHtmlDebugTrait::getResponseLogHandler protected function Provides a Guzzle middleware handler to log every response received.
BrowserHtmlDebugTrait::getTestMethodCaller protected function Retrieves the current calling line in the class under test. 1
BrowserHtmlDebugTrait::htmlOutput protected function Logs a HTML output message in a text file.
BrowserHtmlDebugTrait::initBrowserOutputFile protected function Creates the directory to store browser output.
ConfigTestTrait::configImporter protected function Returns a ConfigImporter object to import test configuration.
ConfigTestTrait::copyConfig protected function Copies configuration objects from source storage to target storage.
DrupalTestCaseTrait::$root protected property The Drupal root directory.
DrupalTestCaseTrait::checkErrorHandlerOnTearDown public function Checks the test error handler after test execution. 1
DrupalTestCaseTrait::getDrupalRoot Deprecated protected static function Returns the Drupal root directory. 1
DrupalTestCaseTrait::setDebugDumpHandler public static function Registers the dumper CLI handler when the DebugDump extension is enabled.
ExtensionListTestTrait::getModulePath protected function Gets the path for the specified module.
ExtensionListTestTrait::getThemePath protected function Gets the path for the specified theme.
HttpKernelUiHelperTrait::$mink protected property Mink session manager.
HttpKernelUiHelperTrait::assertSession public function Returns WebAssert object.
HttpKernelUiHelperTrait::buildUrl protected function Builds a URL from a system path or a URL object.
HttpKernelUiHelperTrait::clickLink protected function Follows a link by complete name.
HttpKernelUiHelperTrait::drupalGet protected function Retrieves a Drupal path.
HttpKernelUiHelperTrait::getDefaultDriverInstance protected function Gets an instance of the default Mink driver.
HttpKernelUiHelperTrait::getNodeElementsByXpath protected function Performs an xpath search on the contents of the internal browser.
HttpKernelUiHelperTrait::getSession public function Returns Mink session.
HttpKernelUiHelperTrait::getUrl protected function Gets the current URL from the browser.
HttpKernelUiHelperTrait::initMink protected function Initializes Mink sessions.
KernelTestBase::$classLoader protected property The class loader.
KernelTestBase::$configImporter protected property The configuration importer.
KernelTestBase::$container protected property The test container.
KernelTestBase::$databasePrefix protected property The test database prefix.
KernelTestBase::$keyValue protected property The key_value service that must persist between container rebuilds.
KernelTestBase::$modules protected static property Modules to install. 624
KernelTestBase::$siteDirectory protected property The relative path to the test site directory.
KernelTestBase::$strictConfigSchema protected property Set to TRUE to strict check all configuration saved. 9
KernelTestBase::$usesSuperUserAccessPolicy protected property Set to TRUE to make user 1 a super user. 1
KernelTestBase::$vfsRoot protected property The virtual filesystem root directory.
KernelTestBase::assertPostConditions protected function 1
KernelTestBase::bootEnvironment protected function Bootstraps a basic test environment.
KernelTestBase::bootKernel protected function Bootstraps a kernel for a test. 1
KernelTestBase::config protected function Configuration accessor for tests. Returns non-overridden configuration.
KernelTestBase::disableModules protected function Disables modules for this test.
KernelTestBase::enableModules protected function Enables modules for this test. 2
KernelTestBase::getConfigSchemaExclusions protected function Gets the config schema exclusions for this test.
KernelTestBase::getDatabaseConnectionInfo protected function Returns the Database connection info to be used for this test. 3
KernelTestBase::getDatabasePrefix public function Gets the database prefix used for test isolation.
KernelTestBase::getExtensionsForModules private function Returns Extension objects for $modules to install.
KernelTestBase::getModulesToEnable protected static function Returns the modules to install for this test.
KernelTestBase::initFileCache protected function Initializes the FileCache component.
KernelTestBase::installConfig protected function Installs default configuration for a given list of modules.
KernelTestBase::installEntitySchema protected function Installs the storage schema for a specific entity type.
KernelTestBase::installSchema protected function Installs database tables from a module schema definition.
KernelTestBase::register public function Registers test-specific services. Overrides ServiceProviderInterface::register 40
KernelTestBase::render protected function Renders a render array. 1
KernelTestBase::setInstallProfile protected function Sets the install profile and rebuilds the container to update it.
KernelTestBase::setSetting protected function Sets an in-memory Settings variable.
KernelTestBase::setUp protected function 454
KernelTestBase::setUpFilesystem protected function Sets up the filesystem, so things like the file directory. 3
KernelTestBase::tearDown protected function 10
KernelTestBase::tearDownCloseDatabaseConnection public function Additional tear down method to close the connection at the end.
KernelTestBase::vfsDump protected function Dumps the current state of the virtual filesystem to STDOUT.
KernelTestBase::__sleep public function Prevents serializing any properties.
MappingTest::$configSchemaCheckerExclusions protected static property Overrides KernelTestBase::$configSchemaCheckerExclusions
MappingTest::providerMappingInterpretation public static function Provides test cases for all kinds of i) dynamic typing, ii) optional keys.
MappingTest::testInvalidMappingKeyDefinition public function Tests invalid mapping key definition.
MappingTest::testInvalidRequiredKeyFlag public function Tests invalid required key flag.
MappingTest::testMappingInterpretation public function Tests mapping interpretation.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers.
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
StorageCopyTrait::replaceStorageContents protected static function Copy the configuration from one storage to another and remove stale items.

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