public function ContentHubTestBase::enableViewModeFor in Acquia Content Hub 8
Enables a view mode to be rendered in CDF.
Parameters
string $entity_type: The entity type.
string $bundle: The bundle.
string|array $view_mode: The view mode(s) to enable.
Throws
\Exception
3 calls to ContentHubTestBase::enableViewModeFor()
- IntegrationTest::checkCdfMarkup in tests/
src/ Functional/ IntegrationTest.php - Ensures the rendered view mode have no extra markup.
- IntegrationTest::testFramework in tests/
src/ Functional/ IntegrationTest.php - Tests various operations via the Acquia Content Hub admin UI.
- ViewModesUtf8EncodedTest::setUp in tests/
src/ Functional/ ViewModesUtf8EncodedTest.php
File
- tests/
src/ Functional/ ContentHubTestBase.php, line 226
Class
- ContentHubTestBase
- Provides the base class for web tests for Search API.
Namespace
Drupal\Tests\acquia_contenthub\FunctionalCode
public function enableViewModeFor($entity_type, $bundle, $view_mode) {
$this
->drupalGet('admin/config/services/acquia-contenthub/configuration');
$this
->assertSession()
->statusCodeEquals(200);
$edit = [
'entities[' . $entity_type . '][' . $bundle . '][enable_viewmodes]' => TRUE,
];
if (is_array($view_mode)) {
foreach ($view_mode as $value) {
$edit['entities[' . $entity_type . '][' . $bundle . '][rendering][]'][$value] = $value;
}
}
else {
$edit['entities[' . $entity_type . '][' . $bundle . '][rendering][]'] = [
$view_mode,
];
}
$this
->submitForm($edit, $this
->t('Save configuration'));
$this
->assertSession()
->statusCodeEquals(200);
$this
->drupalGet('admin/config/services/acquia-contenthub/configuration');
$this
->assertSession()
->statusCodeEquals(200);
}