public function EntityDecoupledTranslationRevisionsTest::testUntranslatableFields in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityDecoupledTranslationRevisionsTest.php \Drupal\KernelTests\Core\Entity\EntityDecoupledTranslationRevisionsTest::testUntranslatableFields()
- 10 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 268
Class
- EntityDecoupledTranslationRevisionsTest
- Test decoupled translation revisions.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testUntranslatableFields($sequence, $default_translation_affected) {
// 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);
}