You are here

public function BlockContentTranslationUITest::testDisabledBundle in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/block_content/src/Tests/BlockContentTranslationUITest.php \Drupal\block_content\Tests\BlockContentTranslationUITest::testDisabledBundle()

Test that no metadata is stored for a disabled bundle.

File

core/modules/block_content/src/Tests/BlockContentTranslationUITest.php, line 162
Contains \Drupal\block_content\Tests\BlockContentTranslationUITest.

Class

BlockContentTranslationUITest
Tests the block content translation UI.

Namespace

Drupal\block_content\Tests

Code

public function testDisabledBundle() {

  // Create a bundle that does not have translation enabled.
  $disabled_bundle = $this
    ->randomMachineName();
  $bundle = entity_create('block_content_type', array(
    'id' => $disabled_bundle,
    'label' => $disabled_bundle,
    'revision' => FALSE,
  ));
  $bundle
    ->save();

  // Create a block content for each bundle.
  $enabled_block_content = $this
    ->createBlockContent();
  $disabled_block_content = $this
    ->createBlockContent(FALSE, $bundle
    ->id());

  // Make sure that only a single row was inserted into the block table.
  $rows = db_query('SELECT * FROM {block_content_field_data} WHERE id = :id', array(
    ':id' => $enabled_block_content
      ->id(),
  ))
    ->fetchAll();
  $this
    ->assertEqual(1, count($rows));
}