Same name and namespace in other branches
  1. 8.x-3.x tests/src/Kernel/QuicktabsConfigSchemaTest.php \Drupal\Tests\quicktabs\Kernel\QuicktabsConfigSchemaTest::testBlockConfigSchema()

Tests the block config schema for block plugins.

Fichier

tests/src/Kernel/QuicktabsConfigSchemaTest.php, line 39

Classe

QuicktabsConfigSchemaTest
Tests the quicktabs config schema.

Namespace

Drupal\Tests\quicktabs\Kernel

Code

public function testBlockConfigSchema() {
    foreach ($this->tabTypeManager
        ->getDefinitions() as $tab_type_id => $definition) {
        $id = strtolower($this->randomMachineName());
        $quicktabs = QuickTabsInstance::create([
            'id' => $id,
            'langcode' => 'es',
            'status' => TRUE,
            'dependencies' => [],
            'label' => 'test',
            'renderer' => 'quick_tabs',
            'options' => [
                'accordion_tabs' => [
                    'jquery_ui' => [
                        'collapsible' => FALSE,
                        'heightStyle' => 'auto',
                    ],
                ],
                'quick_tabs' => [
                    'ajax' => FALSE,
                ],
            ],
            'hide_empty_tabs' => TRUE,
            'default_tab' => 1,
            'configuration_data' => [
                [
                    'title' => 'tab 1',
                    'weight' => 0,
                    'type' => 'block_content',
                    'content' => [
                        'view_content' => [
                            'options' => [
                                'vid' => 'block_content',
                                'display' => 'default',
                                'args' => '',
                            ],
                        ],
                        'node_content' => [
                            'options' => [
                                'nid' => '',
                                'view_mode' => 'full',
                                'hide_title' => TRUE,
                            ],
                        ],
                        'block_content' => [
                            'options' => [
                                'bid' => 'some_block_here',
                                'block_title' => 'abc',
                                'display_title' => TRUE,
                            ],
                        ],
                        'qtabs_content' => [
                            'options' => [
                                'machine_name' => '',
                            ],
                        ],
                    ],
                ],
                [
                    'title' => 'tab 2',
                    'weight' => 0,
                    'type' => 'node_content',
                    'content' => [
                        'view_content' => [
                            'options' => [
                                'vid' => 'block_content',
                                'display' => 'default',
                                'args' => '',
                            ],
                        ],
                        'node_content' => [
                            'options' => [
                                'nid' => '1',
                                'view_mode' => 'full',
                                'hide_title' => FALSE,
                            ],
                        ],
                        'block_content' => [
                            'options' => [
                                'bid' => 'some_block_here',
                                'block_title' => 'abc',
                                'display_title' => TRUE,
                            ],
                        ],
                        'qtabs_content' => [
                            'options' => [
                                'machine_name' => '',
                            ],
                        ],
                    ],
                ],
            ],
        ]);
        $quicktabs->save();
        $config = $this->config("quicktabs.quicktabs_instance.{$id}");
        $this->assertEquals($config->get('id'), $id);
        $this->assertConfigSchema($this->typedConfig, $config->getName(), $config->get());
    }
}