public function NodeTranslationUITest::testDisabledBundle in Drupal 9
Same name and namespace in other branches
- 8 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 281
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.
$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);
}