function EntityDecoupledTranslationRevisionsTest::testUntranslatableFields
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::testUntranslatableFields()
- 8.9.x core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::testUntranslatableFields()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::testUntranslatableFields()
Tests that untranslatable fields are handled correctly.
@covers ::createRevision @covers \Drupal\Core\Entity\Plugin\Validation\Constraint\EntityUntranslatableFieldsConstraintValidator::validate
@dataProvider dataTestUntranslatableFields
Parameters
array[] $sequence: An array with arrays of arguments for the ::doSaveNewRevision() method as values. Every child array corresponds to a method invocation.
bool $default_translation_affected: Whether untranslatable field changes affect all revisions or only the default revision.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityDecoupledTranslationRevisionsTest.php, line 267
Class
- EntityDecoupledTranslationRevisionsTest
- Test decoupled translation revisions.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testUntranslatableFields($sequence, $default_translation_affected) : void {
// Configure the untranslatable fields edit mode.
$this->state
->set('entity_test.untranslatable_fields.default_translation_affected', $default_translation_affected);
$this->bundleInfo
->clearCachedBundles();
// Test that a new entity is always valid.
$entity = EntityTestMulRev::create();
$entity->set('non_mul_field', 0);
$violations = $entity->validate();
$this->assertEmpty($violations);
// Test the specified sequence.
$this->doTestEditSequence($sequence);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.