public function CustomBlockTranslationUITest::testDisabledBundle

Test that no metadata is stored for a disabled bundle.

File

drupal/core/modules/block/custom_block/lib/Drupal/custom_block/Tests/CustomBlockTranslationUITest.php, line 105
Contains \Drupal\custom_block\Tests\CustomBlockTranslationUITest.

Class

CustomBlockTranslationUITest
Tests the Custom Block Translation UI.

Namespace

Drupal\custom_block\Tests

Code

public function testDisabledBundle() {

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

  // Create a node for each bundle.
  $enabled_custom_block = $this
    ->createCustomBlock();
  $disabled_custom_block = $this
    ->createCustomBlock(FALSE, $bundle
    ->id());

  // Make sure that only a single row was inserted into the
  // {translation_entity} table.
  $rows = db_query('SELECT * FROM {translation_entity}')
    ->fetchAll();
  $this
    ->assertEqual(1, count($rows));
  $this
    ->assertEqual($enabled_custom_block
    ->id(), reset($rows)->entity_id);
}