deleteEntityType example

/** * Tests creating a fieldable entity type that doesn't exist in code anymore. * * @covers ::installFieldableEntityType */
  public function testInstallFieldableEntityTypeWithoutInCodeDefinition() {
    $entity_type = clone $this->entityTypeManager->getDefinition('entity_test_update');
    $field_storage_definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions('entity_test_update');

    // Remove the entity type definition. This is the same thing as removing the     // code that defines it.     $this->deleteEntityType();

    // Install the entity type and check that its tables have been created.     $this->entityDefinitionUpdateManager->installFieldableEntityType($entity_type$field_storage_definitions);
    $this->assertTrue($this->database->schema()->tableExists('entity_test_update'), 'The base table of the entity type has been created.');
  }

  /** * Tests updating an entity type that doesn't exist in code anymore. * * @covers ::updateEntityType */
  
Home | Imprint | This part of the site doesn't use cookies.