function StyleMappingTest::testMappedOutput

Same name and namespace in other branches
  1. 8.9.x core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php \Drupal\Tests\views\Kernel\Plugin\StyleMappingTest::testMappedOutput()
  2. 10 core/modules/views/tests/src/Kernel/Plugin/StyleMappingTest.php \Drupal\Tests\views\Kernel\Plugin\StyleMappingTest::testMappedOutput()
  3. 11.x 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 28

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.');
}

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