Issue #3341682: New config schema data type: `required_label`
Merge request reports
Activity
added 1 commit
- 6c4394c6 - Make `Block` pass tests by adding the missing label.
added 1 commit
- 8fc9f0b7 - Add explicit test coverage — both for config entities that store the label in...
added 2 commits
added 1 commit
- 22e74b89 - Some config entity types truly do not have labels.
added 1 commit
- 5630efac - 3 config entity types have been using `label` incorrectly, switch them to `text`.
added 1 commit
- eb066c37 - `system.site`: `slogan` should not use `type: label`, `name` is indeed...
added 1 commit
- 1d45c2bd - When the `label` entity key is the same as the `id` entity key, labellessness is impossible.
added 1 commit
- b6999cb8 - `settings.prefix` & `settings.suffix` should also not have been using `type: label`.
- Resolved by Wim Leers
- Resolved by Wim Leers
168 171 172 /** 173 * Tests validation of config entity's label. 174 * 175 * @see \Drupal\Core\Entity\EntityInterface::label() 176 * @see \Drupal\Core\Entity\EntityBase::label() 177 */ 178 public function testLabelValidation(): void { 179 // Some entity types are labelless: 180 // - \Drupal\Core\Entity\Entity\EntityFormDisplay 181 // - \Drupal\Core\Entity\Entity\EntityViewDisplay 182 // - \Drupal\language\Entity\ContentLanguageSettings 183 // - \Drupal\rest\Entity\RestResourceConfig 184 if ($this->entity->label() === NULL) { 185 $this->markTestSkipped(); 186 } Darn, good catch! Although … that would have meant that every other test method would've triggered a validation error for the missing label!
So it was only a theoretical problem. Still, this code on its own is definitely confusing.So made it more explicit in f2e06614.
changed this line in version 12 of the diff
- Resolved by Wim Leers
- Resolved by Wim Leers
186 } 187 // @todo Remove this in https://www.drupal.org/i/3231354. 188 if ($this->entity->getEntityType()->id() === 'editor') { 189 $this->markTestSkipped(); 190 } 191 // @todo Remove this in https://www.drupal.org/i/2939931. 192 if ($this->entity instanceof LayoutBuilderEntityViewDisplay) { 193 $this->markTestSkipped(); 194 } 195 if ($this->entity->getEntityType()->getKey('label') === $this->entity->getEntityType()->getKey('id')) { 196 $this->markTestSkipped('This entity type uses the ID as the label; a labelless entity is hence impossible.'); 197 } 198 $label_property = $this->entity->getEntityType()->getKey('label'); 199 if ($label_property === FALSE && !method_exists($this, 'removeLabel')) { 200 throw new \LogicException(sprintf('Please implement a removeLabel() method to allow testing a labelless %s.', (string) $this->entity->getEntityType()->getSingularLabel())); 201 } - Resolved by Wim Leers
- Resolved by Wim Leers
Please register or sign in to reply