function ViewsConfigUpdaterTest::testUpdateRssViewMode
Tests the `needsRssViewModeUpdate` method.
File
-
core/
modules/ views/ tests/ src/ Kernel/ ViewsConfigUpdaterTest.php, line 44
Class
Namespace
Drupal\Tests\views\KernelCode
public function testUpdateRssViewMode() : void {
$this->strictConfigSchema = FALSE;
/** @var \Drupal\views\ViewsConfigUpdater $view_config_updater */
$view_config_updater = \Drupal::classResolver(ViewsConfigUpdater::class);
// Load the test view.
$view_id = 'views.view.test_display_feed';
$test_view = $this->loadTestView($view_id);
$display = $test_view->getDisplay('feed_1');
// Check the initial view mode.
$rowViewMode = $display['display_options']['row']['options']['view_mode'] ?? FALSE;
$this->assertEquals('default', $rowViewMode);
// Update the view mode using the method under test.
$view_config_updater->needsRssViewModeUpdate($test_view, 'old_view_mode');
// Assert if the view mode was updated correctly.
$display = $test_view->getDisplay('feed_1');
$updatedRowViewMode = $display['display_options']['row']['options']['view_mode'] ?? FALSE;
$this->assertEquals('old_view_mode', $updatedRowViewMode);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.