Commit 4b31d577 authored by Ted Bowman's avatar Ted Bowman
Browse files

Issue #3322913 by tedbow, Wim Leers: Create an easy way for functional tests...

Issue #3322913 by tedbow, Wim Leers: Create an easy way for functional tests to simulate an update (and update kernel tests to use the same)
parent badd6080
Loading
Loading
Loading
Loading
+27 −20
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ declare(strict_types = 1);
namespace Drupal\Tests\automatic_updates_extensions\Functional;

use Drupal\automatic_updates_test\EventSubscriber\TestSubscriber1;
use Drupal\fixture_manipulator\ActiveFixtureManipulator;
use Drupal\package_manager_test_validation\StagedDatabaseUpdateValidator;
use Drupal\package_manager\Event\PreApplyEvent;
use Drupal\package_manager\Event\StatusCheckEvent;
@@ -88,24 +89,26 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
      'access administration pages',
    ]);
    $this->activeDir = $this->container->get('package_manager.path_locator')->getProjectRoot();
    $this->addPackage($this->activeDir, [
    (new ActiveFixtureManipulator())
      ->addPackage([
        'name' => 'drupal/semver_test',
        'version' => '8.1.0',
        'type' => 'drupal-module',
        'install_path' => '../../web/projects/semver_test',
    ]);
    $this->addPackage($this->activeDir, [
      ])
      ->addPackage([
        'name' => 'drupal/aaa_update_test',
        'version' => '2.0.0',
        'type' => 'drupal-module',
        'install_path' => '../../web/projects/aaa_update_test',
    ]);
    $this->addPackage($this->activeDir, [
      ])
      ->addPackage([
        'name' => 'drupal/automatic_updates_extensions_test_theme',
        'version' => '2.0.0',
        'type' => 'drupal-theme',
        'install_path' => '../../web/projects/automatic_updates_extensions_test_theme',
    ]);
      ])
      ->commitChanges();
    $this->drupalLogin($user);
    $this->drupalPlaceBlock('local_tasks_block', ['primary' => TRUE]);
  }
@@ -448,7 +451,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
      ]
    );
    // One module not installed through composer.
    $this->removePackage($this->activeDir, 'drupal/aaa_update_test');
    (new ActiveFixtureManipulator())
      ->removePackage('drupal/aaa_update_test')
      ->commitChanges();
    $assert = $this->assertSession();
    $user = $this->createUser(
      [
@@ -464,7 +469,9 @@ class UpdaterFormTest extends AutomaticUpdatesFunctionalTestBase {
    $this->assertUpdatesCount(1);

    // Both of the modules not installed through composer.
    $this->removePackage($this->activeDir, 'drupal/semver_test');
    (new ActiveFixtureManipulator())
      ->removePackage('drupal/semver_test')
      ->commitChanges();
    $this->getSession()->reload();
    $assert->pageTextContains('Updates were found, but they must be performed manually. See the list of available updates for more information.');
    $this->assertNoUpdates();
+0 −1
Original line number Diff line number Diff line
{}
+0 −1
Original line number Diff line number Diff line
{}
+0 −34
Original line number Diff line number Diff line
{
  "packages": [
    {
      "name": "drupal/package_project_match",
      "version": "6.1.3",
      "type": "drupal-module"
    },
    {
      "name": "drupal/not_match_package",
      "version": "6.1.3",
      "type": "drupal-theme"
    },
    {
      "name": "drupal/not_match_path_project",
      "version": "6.1.3",
      "type": "drupal-module"
    },
    {
      "name": "non_drupal/other_project",
      "version": "6.1.3",
      "type": "drupal-module"
    },
    {
      "name": "drupal/nested_no_match_package",
      "version": "6.1.3",
      "type": "drupal-profile"
    },
    {
      "name": "drupal/custom_module",
      "version": "6.1.3",
      "type": "drupal-custom-module"
    }
  ]
}
+0 −35
Original line number Diff line number Diff line
<?php

/**
 * @file
 */

$projects_dir = __DIR__ . '/../../web/projects';
return [
  'versions' => [
    'drupal/package_project_match' => [
      'type' => 'drupal-module',
      'install_path' => $projects_dir . '/package_project_match',
    ],
    'drupal/not_match_package' => [
      'type' => 'drupal-module',
      'install_path' => $projects_dir . '/not_match_project',
    ],
    'drupal/not_match_path_project' => [
      'type' => 'drupal-module',
      'install_path' => $projects_dir . '/not_match_project',
    ],
    'drupal/nested_no_match_package' => [
      'type' => 'drupal-module',
      'install_path' => $projects_dir . '/any_folder_name',
    ],
    'non_drupal/other_project' => [
      'type' => 'drupal-module',
      'install_path' => $projects_dir . '/other_project',
    ],
    'drupal/custom_module' => [
      'type' => 'drupal-custom-module',
      'install_path' => $projects_dir . '/custom_module',
    ],
  ],
];
Loading