use Drupal\Core\Entity\EntityType;
use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\StringTranslation\TranslatableMarkup;
+use Drupal\Core\StringTranslation\TranslationInterface;
use Drupal\Tests\UnitTestCase;
/**
$this->assertEmpty($reflection->getProperties(\ReflectionProperty::IS_PUBLIC));
}
+ /**
+ * Tests that the EntityType object can be serialized.
+ */
+ public function testIsSerializable() {
+ $entity_type = $this->setUpEntityType([]);
+
+ $translation = $this->prophesize(TranslationInterface::class);
+ $translation->willImplement(\Serializable::class);
+ $translation->serialize()->willThrow(\Exception::class);
+ $translation_service = $translation->reveal();
+ $translation_service->_serviceId = 'string_translation';
+
+ $entity_type->setStringTranslation($translation_service);
+ $entity_type = unserialize(serialize($entity_type));
+
+ $this->assertEquals('example_entity_type', $entity_type->id());
+ }
+
}