public function NodeTranslationUITest::testDisabledBundle in Drupal 8
Same name and namespace in other branches
- 9 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::testDisabledBundle()
- 10 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::testDisabledBundle()
Tests that no metadata is stored for a disabled bundle.
File
- core/
modules/ node/ tests/ src/ Functional/ NodeTranslationUITest.php, line 270
Class
- NodeTranslationUITest
- Tests the Node Translation UI.
Namespace
Drupal\Tests\node\FunctionalCode
public function testDisabledBundle() {
// Create a bundle that does not have translation enabled.
$disabledBundle = $this
->randomMachineName();
$this
->drupalCreateContentType([
'type' => $disabledBundle,
'name' => $disabledBundle,
]);
// Create a node for each bundle.
$node = $this
->drupalCreateNode([
'type' => $this->bundle,
'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED,
]);
// Make sure that nothing was inserted into the {content_translation} table.
$rows = Database::getConnection()
->query('SELECT nid, count(nid) AS count FROM {node_field_data} WHERE type <> :type GROUP BY nid HAVING count(nid) >= 2', [
':type' => $this->bundle,
])
->fetchAll();
$this
->assertCount(0, $rows);
// Ensure the translation tab is not accessible.
$this
->drupalGet('node/' . $node
->id() . '/translations');
$this
->assertSession()
->statusCodeEquals(403);
}