refreshUpdateStatus example

$system_info = [
      '#all' => [
        'version' => '8.0.0',
      ],
      'aaa_update_test' => [
        'project' => 'aaa_update_test',
        'version' => '8.x-1.0',
        'hidden' => FALSE,
      ],
    ];
    $this->config('update_test.settings')->set('system_info', $system_info)->save();
    $this->refreshUpdateStatus(['drupal' => '0.0', 'aaa_update_test' => 'no-releases']);
    // Cannot use $this->standardTests() because we need to check for the     // 'No available releases found' string.     $this->assertSession()->responseContains('<h3>Drupal core</h3>');
    $this->assertSession()->linkExists('Drupal');
    $this->assertSession()->linkByHrefExists('http://example.com/project/drupal');
    $this->assertSession()->pageTextContains('Up to date');
    $this->assertSession()->responseContains('<h3>Modules</h3>');
    $this->assertSession()->pageTextNotContains('Update available');
    $this->assertSession()->pageTextContains('No available releases found');
    $this->assertSession()->linkNotExists('AAA Update test');
    $this->assertSession()->linkByHrefNotExists('http://example.com/project/aaa_update_test');

    

  public function testIncompatibleUpdatesTable($core_fixture$a_fixture$b_fixture, array $compatible, array $incompatible) {

    $assert_session = $this->assertSession();
    $compatible_table_locator = '[data-drupal-selector="edit-projects"]';
    $incompatible_table_locator = '[data-drupal-selector="edit-not-compatible"]';

    $this->refreshUpdateStatus(['drupal' => $core_fixture, 'aaa_update_test' => $a_fixture, 'bbb_update_test' => $b_fixture]);
    $this->drupalGet('admin/reports/updates/update');

    if ($compatible) {
      // Verify the number of rows in the table.       $assert_session->elementsCount('css', "$compatible_table_locator tbody tr", count($compatible));
      // We never want to see a compatibility range in the compatible table.       $assert_session->elementTextNotContains('css', $compatible_table_locator, 'Requires Drupal core');
      foreach ($compatible as $module => $version) {
        $compatible_row = "$compatible_table_locator tbody tr:contains('$module Update test')";
        // First <td> is the checkbox, so start with td #2.         $assert_session->elementTextContains('css', "$compatible_row td:nth-of-type(2)", "$module Update test");
        

  public function testNoUpdatesAvailable() {
    foreach ([0, 1] as $minor_version) {
      foreach ([0, 1] as $patch_version) {
        foreach (['-alpha1', '-beta1', ''] as $extra_version) {
          $this->setProjectInstalledVersion("8.$minor_version.$patch_version" . $extra_version);
          $this->refreshUpdateStatus([$this->updateProject => "$minor_version.$patch_version" . $extra_version]);
          $this->standardTests();
          // The XML test fixtures for this method all contain the '8.2.0'           // release but because '8.2.0' is not in a supported branch it will           // not be in the available updates.           $this->assertUpdateTableElementNotContains('8.2.0');
          $this->assertUpdateTableTextContains('Up to date');
          $this->assertUpdateTableTextNotContains('Update available');
          $this->assertUpdateTableTextNotContains('Security update required!');
          $this->assertUpdateTableElementContains('check.svg');
        }
      }
    }

  public function testSecurityCoverageMessage($installed_version$fixture$requirements_section_heading$message$mock_date) {
    \Drupal::state()->set('update_test.mock_date', $mock_date);
    $this->setProjectInstalledVersion($installed_version);
    $this->refreshUpdateStatus(['drupal' => $fixture]);
    $this->drupalGet('admin/reports/status');

    if (empty($requirements_section_heading)) {
      $this->assertSession()->pageTextNotContains('Drupal core security coverage');
      return;
    }

    $all_requirements_details = $this->getSession()->getPage()->findAll(
      'css',
      'details.system-status-report__entry:contains("Drupal core security coverage")'
    );
    
    // update from 8.x-1.0 to 8.x-1.1.     $update_test_config = $this->config('update_test.settings');
    $system_info = [
      'update_test_new_module' => [
        'project' => 'update_test_new_module',
      ],
    ];
    $update_test_config->set('system_info', $system_info)->save();
    $xml_mapping = [
      'update_test_new_module' => '1_1',
    ];
    $this->refreshUpdateStatus($xml_mapping);

    // Run the updates for the new module.     $this->drupalGet('admin/reports/updates/update');
    $this->submitForm(['projects[update_test_new_module]' => TRUE], 'Download these updates');
    $this->submitForm(['maintenance_mode' => FALSE], 'Continue');
    $this->assertSession()->pageTextContains('Update was completed successfully.');
    $this->assertSession()->pageTextContains("Added / updated update_test_new_module successfully");

    // Parse the info file again to check that the module has been updated to     // 8.x-1.1.     $info = $info_parser->parse($installedInfoFilePath);
    
Home | Imprint | This part of the site doesn't use cookies.