Newer
Older
Angie Byron
committed
<?php
/**
* @file
* Contains \Drupal\system\Tests\Update\UpdatesWith7xTest.
Angie Byron
committed
*/
namespace Drupal\system\Tests\Update;
use Drupal\simpletest\WebTestBase;
/**
* Tests that the minimum schema version is correct even if only 7.x update
* hooks are retained .
*
* @group Update
Angie Byron
committed
*/
class UpdatesWith7xTest extends WebTestBase {
Angie Byron
committed
/**
* Modules to enable.
*
* @var array
*/
public static $modules = array('update_test_with_7x');
/**
* The URL for the update page.
*/
private $updateUrl;
Angie Byron
committed
/**
* An administrative user.
*/
private $updateUser;
Angie Byron
committed
Alex Pott
committed
protected function setUp() {
Angie Byron
committed
parent::setUp();
require_once \Drupal::root() . '/core/includes/update.inc';
$this->updateUrl = $GLOBALS['base_url'] . '/update.php';
$this->updateUser = $this->drupalCreateUser(array('administer software updates'));
Angie Byron
committed
}
function testWith7x() {
// Ensure that the minimum schema version is 8000, despite 7200 update
// hooks and a 7XXX hook_update_last_removed().
$this->assertEqual(drupal_get_installed_schema_version('update_test_with_7x'), 8000);
// Try to manually set the schema version to 7110 and ensure that no
// updates are allowed.
drupal_set_installed_schema_version('update_test_with_7x', 7110);
// Click through update.php with 'administer software updates' permission.
$this->drupalLogin($this->updateUser);
$this->drupalGet($this->updateUrl, array('external' => TRUE));
$this->clickLink(t('Continue'));
Angie Byron
committed
$this->assertText(t('Some of the pending updates cannot be applied because their dependencies were not met.'));
}
}