public function BlockContentTranslationUITest::testDisabledBundle in Drupal 8
Test that no metadata is stored for a disabled bundle.
File
- core/
modules/ block_content/ tests/ src/ Functional/ BlockContentTranslationUITest.php, line 162
Class
- BlockContentTranslationUITest
- Tests the block content translation UI.
Namespace
Drupal\Tests\block_content\FunctionalCode
public function testDisabledBundle() {
// Create a bundle that does not have translation enabled.
$disabled_bundle = $this
->randomMachineName();
$bundle = BlockContentType::create([
'id' => $disabled_bundle,
'label' => $disabled_bundle,
'revision' => FALSE,
]);
$bundle
->save();
// Create a block content for each bundle.
$enabled_block_content = $this
->createBlockContent();
$disabled_block_content = $this
->createBlockContent(FALSE, $bundle
->id());
// Make sure that only a single row was inserted into the block table.
$rows = Database::getConnection()
->query('SELECT * FROM {block_content_field_data} WHERE id = :id', [
':id' => $enabled_block_content
->id(),
])
->fetchAll();
$this
->assertCount(1, $rows);
}