Unverified Commit b2519618 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3132759 by mvonfrie, AaronBauman, anmolgoyal74, jungle, DamienMcKenna:...

Issue #3132759 by mvonfrie, AaronBauman, anmolgoyal74, jungle, DamienMcKenna: ConfigEntityType "missing 'config_export" error message doesn't say what annotation is missing
parent fad126b7
Loading
Loading
Loading
Loading
+1 −1
Changes for core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -248,7 +248,7 @@ public function toArray() {
    $id_key = $entity_type->getKey('id');
    $property_names = $entity_type->getPropertiesToExport($this->id());
    if (empty($property_names)) {
      throw new SchemaIncompleteException(sprintf("Entity type '%s' is missing 'config_export' definition in its annotation", get_class($entity_type)));
      throw new SchemaIncompleteException(sprintf("Entity type '%s' is missing 'config_export' definition in its annotation", $entity_type->getClass()));
    }
    foreach ($property_names as $property_name => $export_name) {
      // Special handling for IDs so that computed compound IDs work.
+4 −1
Changes for core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -635,8 +635,11 @@ public function testToArraySchemaException() {
    $this->entityType->expects($this->any())
      ->method('getPropertiesToExport')
      ->willReturn(NULL);
    $this->entityType->expects($this->any())
      ->method('getClass')
      ->willReturn("FooConfigEntity");
    $this->expectException(SchemaIncompleteException::class);
    $this->expectExceptionMessageMatches("/Entity type 'Mock_ConfigEntityTypeInterface_[^']*' is missing 'config_export' definition in its annotation/");
    $this->expectExceptionMessage("Entity type 'FooConfigEntity' is missing 'config_export' definition in its annotation");
    $this->entity->toArray();
  }