You are here

public function ViewFieldUnitTest::testNormalView in Views Field View 8

Test normal view embedding.

File

tests/src/Kernel/ViewFieldUnitTest.php, line 50

Class

ViewFieldUnitTest
Tests the views field view handler methods.

Namespace

Drupal\Tests\views_field_view\Kernel

Code

public function testNormalView() {
  $parent_view = Views::getView('views_field_view_test_parent_normal');
  $parent_view
    ->preview();

  // Check that the child view has the same title as the parent one.
  foreach ($parent_view->result as $index => $values) {
    $name = $parent_view->style_plugin
      ->getField($index, 'name');
    $child_view_field = $parent_view->style_plugin
      ->getField($index, 'view');
    $this
      ->assertStringContainsString((string) $name, (string) $child_view_field);
  }

  // It's impossible to check the actual result of the child view, because the
  // object is not saved.
}