You are here

public function FieldFieldTest::testMissingBundleFieldRender in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/views/src/Tests/Handler/FieldFieldTest.php \Drupal\views\Tests\Handler\FieldFieldTest::testMissingBundleFieldRender()

Tests that a field not available for every bundle is rendered as empty.

File

core/modules/views/src/Tests/Handler/FieldFieldTest.php, line 536
Contains \Drupal\views\Tests\Handler\FieldFieldTest.

Class

FieldFieldTest
Provides some integration tests for the Field handler.

Namespace

Drupal\views\Tests\Handler

Code

public function testMissingBundleFieldRender() {

  // Create a new bundle not having the test field attached.
  $bundle = $this
    ->randomMachineName();
  entity_test_create_bundle($bundle);
  $entity = EntityTest::create([
    'type' => $bundle,
    'name' => $this
      ->randomString(),
    'user_id' => $this->testUsers[0]
      ->id(),
  ]);
  $entity
    ->save();
  $executable = Views::getView('test_field_field_test');
  $executable
    ->execute();
  $this
    ->assertEqual('', $executable
    ->getStyle()
    ->getField(6, 'field_test'));
}