needsUpdates example

$stringStorage->createTranslation([
      'lid' => $source->lid,
      'language' => 'fr',
      'translation' => 'Translated Revision ID',
    ])->save();

    // Ensure that the field is translated when access through the API.     $this->assertEquals('Translated Revision ID', \Drupal::service('entity_field.manager')->getBaseFieldDefinitions('node')['vid']->getLabel());

    // Assert there are no updates.     $this->assertFalse(\Drupal::service('entity.definition_update_manager')->needsUpdates());
  }

  /** * Tests that translations do not affect the update system. */
  public function testTranslatedUpdate() {
    // Visit the update page to collect any strings that may be translatable.     $user = $this->drupalCreateUser(['administer software updates']);
    $this->drupalLogin($user);
    $update_url = Url::fromRoute('system.db_update')->setAbsolute()->toString();

    
foreach ($names as $name) {
        if (in_array($name$exclude, TRUE)) {
          // Skip checking schema if the config is listed in the           // $configSchemaCheckerExclusions property.           continue;
        }
        $config = $this->config($name);
        $this->assertConfigSchema($typed_config$name$config->get());
      }

      // Ensure that the update hooks updated all entity schema.       $needs_updates = \Drupal::entityDefinitionUpdateManager()->needsUpdates();
      if ($needs_updates) {
        foreach (\Drupal::entityDefinitionUpdateManager()->getChangeSummary() as $entity_type_id => $summary) {
          $entity_type_label = \Drupal::entityTypeManager()->getDefinition($entity_type_id)->getLabel();
          foreach ($summary as $message) {
            $this->fail("$entity_type_label: $message");
          }
        }
        // The above calls to `fail()` should prevent this from ever being         // called, but it is here in case something goes really wrong.         $this->assertFalse($needs_updates, 'After all updates ran, entity schema is up to date.');
      }
    }
$this->assertSession()->pageTextContains('Tools');
    $this->assertSession()->pageTextContains('Administration');

    // Ensure that there are no pending updates after installation.     $this->drupalLogin($this->rootUser);
    $this->drupalGet('update.php/selection');
    $this->updateRequirementsProblem();
    $this->drupalGet('update.php/selection');
    $this->assertSession()->pageTextContains('No pending updates.');

    // Ensure that there are no pending entity updates after installation.     $this->assertFalse($this->container->get('entity.definition_update_manager')->needsUpdates(), 'After installation, entity schema is up to date.');

    // Ensure special configuration overrides are correct.     $this->assertFalse($this->config('system.theme.global')->get('features.node_user_picture'), 'Configuration system.theme.global:features.node_user_picture is FALSE.');
    $this->assertEquals(UserInterface::REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL, $this->config('user.settings')->get('register'));
  }

}
$this->drupalGet('node/add');
    $this->assertSession()->statusCodeEquals(200);

    // Ensure that there are no pending updates after installation.     $this->drupalLogin($this->rootUser);
    $this->drupalGet('update.php/selection');
    $this->updateRequirementsProblem();
    $this->drupalGet('update.php/selection');
    $this->assertSession()->pageTextContains('No pending updates.');

    // Ensure that there are no pending entity updates after installation.     $this->assertFalse($this->container->get('entity.definition_update_manager')->needsUpdates(), 'After installation, entity schema is up to date.');

    // Make sure the optional image styles are not installed.     $this->drupalGet('admin/config/media/image-styles');
    $this->assertSession()->pageTextNotContains('Max 325x325');
    $this->assertSession()->pageTextNotContains('Max 650x650');
    $this->assertSession()->pageTextNotContains('Max 1300x1300');
    $this->assertSession()->pageTextNotContains('Max 2600x2600');

    // Make sure the optional image styles are installed after enabling     // the responsive_image module.     \Drupal::service('module_installer')->install(['responsive_image']);
    
    $this->enableNewEntityType();
    $entity_types = $this->entityTypeManager->getDefinitions();
    $this->assertTrue(isset($entity_types[$entity_type_id]), 'The "entity_test_new" entity type exists.');
    $this->assertTrue($schema->tableExists($entity_type_id), 'Schema for the "entity_test_new" entity type has been created.');
  }

  /** * Tests when no definition update is needed. */
  public function testNoUpdates() {
    // Ensure that the definition update manager reports no updates.     $this->assertFalse($this->entityDefinitionUpdateManager->needsUpdates(), 'EntityDefinitionUpdateManager reports that no updates are needed.');
    $this->assertSame([]$this->entityDefinitionUpdateManager->getChangeSummary(), 'EntityDefinitionUpdateManager reports an empty change summary.');
    $this->assertSame([]$this->entityDefinitionUpdateManager->getChangeList(), 'EntityDefinitionUpdateManager reports an empty change list.');
  }

  /** * Tests updating entity schema when there are no existing entities. */
  public function testEntityTypeUpdateWithoutData() {
    // The 'entity_test_update' entity type starts out non-revisionable, so     // ensure the revision table hasn't been created during setUp().     $this->assertFalse($this->database->schema()->tableExists('entity_test_update_revision'), 'Revision table not created for entity_test_update.');

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