Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / system / tests / src / Functional / Update / UpdatesWith7xTest.php
1 <?php
2
3 namespace Drupal\Tests\system\Functional\Update;
4
5 use Drupal\Tests\BrowserTestBase;
6
7 /**
8  * Tests that the minimum schema version is correct even if only 7.x update
9  * hooks are retained .
10  *
11  * @group Update
12  */
13 class UpdatesWith7xTest extends BrowserTestBase {
14
15   /**
16    * Modules to enable.
17    *
18    * @var array
19    */
20   public static $modules = ['update_test_with_7x'];
21
22   /**
23    * The URL for the update page.
24    */
25   private $updateUrl;
26
27   /**
28    * An administrative user.
29    */
30   private $updateUser;
31
32   protected function setUp() {
33     parent::setUp();
34     require_once \Drupal::root() . '/core/includes/update.inc';
35     $this->updateUrl = $GLOBALS['base_url'] . '/update.php';
36     $this->updateUser = $this->drupalCreateUser(['administer software updates']);
37   }
38
39   public function testWith7x() {
40     // Ensure that the minimum schema version is 8000, despite 7200 update
41     // hooks and a 7XXX hook_update_last_removed().
42     $this->assertEqual(drupal_get_installed_schema_version('update_test_with_7x'), 8000);
43
44     // Try to manually set the schema version to 7110 and ensure that no
45     // updates are allowed.
46     drupal_set_installed_schema_version('update_test_with_7x', 7110);
47
48     // Click through update.php with 'administer software updates' permission.
49     $this->drupalLogin($this->updateUser);
50     $this->drupalGet($this->updateUrl, ['external' => TRUE]);
51     $this->clickLink(t('Continue'));
52     $this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
53   }
54
55 }