function DateTestBase::renderTestEntity

Same name in other branches
  1. 9 core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::renderTestEntity()
  2. 8.9.x core/modules/datetime/src/Tests/DateTestBase.php \Drupal\datetime\Tests\DateTestBase::renderTestEntity()
  3. 8.9.x core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::renderTestEntity()
  4. 11.x core/modules/datetime/tests/src/Functional/DateTestBase.php \Drupal\Tests\datetime\Functional\DateTestBase::renderTestEntity()

Renders an entity_test and sets the output in the internal browser.

Parameters

int $id: The entity_test ID to render.

string $view_mode: (optional) The view mode to use for rendering. Defaults to 'full'.

bool $reset: (optional) Whether to reset the entity_test controller cache. Defaults to TRUE to simplify testing.

Return value

string The rendered HTML output.

6 calls to DateTestBase::renderTestEntity()
DateRangeFieldTest::doTestFromToSetting in core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
Performs the test of the 'from_to' setting for given test data.
DateRangeFieldTest::testAlldayRangeField in core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
Tests all-day field.
DateRangeFieldTest::testDateRangeField in core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
Tests date field functionality.
DateRangeFieldTest::testDatetimeRangeField in core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
Tests date and time field.
DateTimeFieldTest::testDateField in core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
Tests date field functionality.

... See full list

File

core/modules/datetime/tests/src/Functional/DateTestBase.php, line 170

Class

DateTestBase
Provides a base class for testing Datetime field functionality.

Namespace

Drupal\Tests\datetime\Functional

Code

protected function renderTestEntity($id, $view_mode = 'full', $reset = TRUE) {
    if ($reset) {
        $this->container
            ->get('entity_type.manager')
            ->getStorage('entity_test')
            ->resetCache([
            $id,
        ]);
    }
    $entity = EntityTest::load($id);
    $display = EntityViewDisplay::collectRenderDisplay($entity, $view_mode);
    $build = $display->build($entity);
    return (string) $this->container
        ->get('renderer')
        ->renderRoot($build);
}

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