public function NodeTranslationUITest::testDisabledBundle

Tests that no metadata is stored for a disabled bundle.

File

drupal/core/modules/node/lib/Drupal/node/Tests/NodeTranslationUITest.php, line 182
Definition of Drupal\node\Tests\NodeTranslationUITest.

Class

NodeTranslationUITest
Tests the Node Translation UI.

Namespace

Drupal\node\Tests

Code

public function testDisabledBundle() {

  // Create a bundle that does not have translation enabled.
  $disabledBundle = $this
    ->randomName();
  $this
    ->drupalCreateContentType(array(
    'type' => $disabledBundle,
    'name' => $disabledBundle,
  ));

  // Create a node for each bundle.
  $enabledNode = $this
    ->drupalCreateNode(array(
    'type' => $this->bundle,
  ));
  $disabledNode = $this
    ->drupalCreateNode(array(
    'type' => $disabledBundle,
  ));

  // 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($enabledNode
    ->id(), reset($rows)->entity_id);
}