ComponentInvalidReplacementTest.php

Same filename in this branch
  1. 10 core/modules/sdc/tests/src/Kernel/ComponentInvalidReplacementTest.php
Same filename in other branches
  1. 11.x core/modules/sdc/tests/src/Kernel/ComponentInvalidReplacementTest.php
  2. 11.x core/tests/Drupal/KernelTests/Components/ComponentInvalidReplacementTest.php

Namespace

Drupal\KernelTests\Components

File

core/tests/Drupal/KernelTests/Components/ComponentInvalidReplacementTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\KernelTests\Components;

use Drupal\Core\Render\Component\Exception\IncompatibleComponentSchema;
use Drupal\Tests\Core\Theme\Component\ComponentKernelTestBase;

/**
 * Tests invalid render options for components.
 *
 * @group sdc
 */
class ComponentInvalidReplacementTest extends ComponentKernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'sdc_test_replacements_invalid',
    ];
    
    /**
     * {@inheritdoc}
     */
    protected static $themes = [
        'sdc_theme_test',
    ];
    
    /**
     * Ensure that component replacement validates the schema compatibility.
     */
    public function testInvalidDefinitionTheme() : void {
        $this->expectException(IncompatibleComponentSchema::class);
        $this->manager
            ->getDefinitions();
    }

}

Classes

Title Deprecated Summary
ComponentInvalidReplacementTest Tests invalid render options for components.

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