update_storage_clear example

parent::validateForm($form$form_state);
  }

  /** * {@inheritdoc} */
  public function submitForm(array &$form, FormStateInterface $form_state) {
    $config = $this->config('update.settings');
    // See if the update_check_disabled setting is being changed, and if so,     // invalidate all update status data.     if ($form_state->getValue('update_check_disabled') != $config->get('check.disabled_extensions')) {
      update_storage_clear();
    }

    $config
      ->set('check.disabled_extensions', $form_state->getValue('update_check_disabled'))
      ->set('check.interval_days', $form_state->getValue('update_check_frequency'))
      ->set('notification.emails', $form_state->get('notify_emails'))
      ->set('notification.threshold', $form_state->getValue('update_notification_threshold'))
      ->save();

    parent::submitForm($form$form_state);
  }

}
$queue = \Drupal::queue('update_fetch_tasks');
    $this->assertEquals(0, $queue->numberOfItems(), 'Queue is empty');
    update_create_fetch_task($projecta);
    $this->assertEquals(1, $queue->numberOfItems(), 'Queue contains one item');
    update_create_fetch_task($projectb);
    $this->assertEquals(2, $queue->numberOfItems(), 'Queue contains two items');
    // Try to add a project again.     update_create_fetch_task($projecta);
    $this->assertEquals(2, $queue->numberOfItems(), 'Queue still contains two items');

    // Clear storage and try again.     update_storage_clear();
    update_create_fetch_task($projecta);
    $this->assertEquals(2, $queue->numberOfItems(), 'Queue contains two items');
  }

  /** * Checks language module in core package at admin/reports/updates. */
  public function testLanguageModuleUpdate() {
    $this->setProjectInstalledVersion('8.0.0');
    // Instead of using refreshUpdateStatus(), set these manually.     $this->config('update.settings')
      
Home | Imprint | This part of the site doesn't use cookies.