function SectionTest::assertComponents

Same name and namespace in other branches
  1. 9 core/modules/layout_builder/tests/src/Unit/SectionTest.php \Drupal\Tests\layout_builder\Unit\SectionTest::assertComponents()
  2. 10 core/modules/layout_builder/tests/src/Unit/SectionTest.php \Drupal\Tests\layout_builder\Unit\SectionTest::assertComponents()
  3. 11.x core/modules/layout_builder/tests/src/Unit/SectionTest.php \Drupal\Tests\layout_builder\Unit\SectionTest::assertComponents()

Asserts that the section has the expected components.

Parameters

\Drupal\layout_builder\SectionComponent[] $expected: The expected sections.

\Drupal\layout_builder\Section $section: The section storage to check.

6 calls to SectionTest::assertComponents()
SectionTest::testAppendComponent in core/modules/layout_builder/tests/src/Unit/SectionTest.php
@covers ::appendComponent @covers ::getNextHighestWeight @covers ::getComponentsByRegion
SectionTest::testGetComponents in core/modules/layout_builder/tests/src/Unit/SectionTest.php
@covers ::__construct @covers ::setComponent @covers ::getComponents
SectionTest::testInsertAfterComponent in core/modules/layout_builder/tests/src/Unit/SectionTest.php
@covers ::insertAfterComponent
SectionTest::testInsertComponent in core/modules/layout_builder/tests/src/Unit/SectionTest.php
@covers ::insertComponent @covers ::getComponentsByRegion
SectionTest::testInsertComponentAppend in core/modules/layout_builder/tests/src/Unit/SectionTest.php
@covers ::insertComponent

... See full list

File

core/modules/layout_builder/tests/src/Unit/SectionTest.php, line 188

Class

SectionTest
@coversDefaultClass <a href="/api/drupal/core%21modules%21layout_builder%21src%21Section.php/class/Section/8.9.x" title="Provides a domain object for layout sections." class="local">\Drupal\layout_builder\Section</a> @group layout_builder

Namespace

Drupal\Tests\layout_builder\Unit

Code

protected function assertComponents(array $expected, Section $section) {
    $result = $section->getComponents();
    $this->assertEquals($expected, $result);
    $this->assertSame(array_keys($expected), array_keys($result));
}

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