function ContentLanguageSettingsValidationTest::testTargetBundleMustExist

Same name and namespace in other branches
  1. 11.x core/modules/language/tests/src/Kernel/ContentLanguageSettingsValidationTest.php \Drupal\Tests\language\Kernel\ContentLanguageSettingsValidationTest::testTargetBundleMustExist()

Tests that the target bundle of the language content settings is checked.

File

core/modules/language/tests/src/Kernel/ContentLanguageSettingsValidationTest.php, line 62

Class

ContentLanguageSettingsValidationTest
Tests validation of content_language_settings entities.

Namespace

Drupal\Tests\language\Kernel

Code

public function testTargetBundleMustExist() : void {
  $this->entity
    ->set('target_bundle', 'superhero');
  $this->assertValidationErrors([
    '' => "The 'target_bundle' property cannot be changed.",
    'target_bundle' => "The 'superhero' bundle does not exist on the 'node' entity type.",
  ]);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.