getFieldInfoConstraints example

protected function setDatabaseDumpFiles() {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-9.4.0.filled.standard.php.gz',
    ];
  }

  /** * Tests the upgrade path for moderation state reindexing. */
  public function testRunUpdates() {
    $constraint = 'UniqueField';
    $constraints = $this->getFieldInfoConstraints();
    if (!isset($constraints[$constraint])) {
      $constraints[$constraint] = [];
      $field_storage_definition = $this->entityDefinitionUpdateManager->getFieldStorageDefinition('info', 'block_content');
      $field_storage_definition->setConstraints($constraints);
      $this->entityDefinitionUpdateManager->updateFieldStorageDefinition($field_storage_definition);
    }

    $this->assertCount(2, $this->getFieldInfoConstraints());

    $this->runUpdates();

    
Home | Imprint | This part of the site doesn't use cookies.