You are here

public function StyleMappingTest::testMappedOutput in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php \Drupal\Tests\views\Kernel\Plugin\StyleMappingTest::testMappedOutput()

Verifies that the fields were mapped correctly.

File

core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php, line 27

Class

StyleMappingTest
Tests mapping style functionality.

Namespace

Drupal\Tests\views\Kernel\Plugin

Code

public function testMappedOutput() {
  $view = Views::getView('test_style_mapping');
  $output = $this
    ->mappedOutputHelper($view);
  $this
    ->assertStringNotContainsString('job', $output, 'The job field is added to the view but not in the mapping.');
  $view
    ->destroy();
  $view
    ->setDisplay();
  $view->displayHandlers
    ->get('default')->options['style']['options']['mapping']['name_field'] = 'job';
  $output = $this
    ->mappedOutputHelper($view);
  $this
    ->assertStringContainsString('job', $output, 'The job field is added to the view and is in the mapping.');
}