function NodeTranslationUITest::testDisabledBundle
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodeTranslationUITest.php \Drupal\Tests\node\Functional\NodeTranslationUITest::testDisabledBundle()
- 8.9.x 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 275
Class
- NodeTranslationUITest
- Tests the Node Translation UI.
Namespace
Drupal\Tests\node\FunctionalCode
public function testDisabledBundle() : void {
// 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.
$nids = \Drupal::entityQueryAggregate('node')->aggregate('nid', 'COUNT')
->accessCheck(FALSE)
->condition('type', $this->bundle)
->conditionAggregate('nid', 'COUNT', 2, '>=')
->groupBy('nid')
->execute();
$this->assertCount(0, $nids);
// Ensure the translation tab is not accessible.
$this->drupalGet('node/' . $node->id() . '/translations');
$this->assertSession()
->statusCodeEquals(403);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.