1 system.test | UpdateScriptFunctionalTest::testUpdateAccess() |
Tests access to the update script.
File
- core/
modules/ system/ tests/ system.test, line 2152 - Tests for system.module.
Class
- UpdateScriptFunctionalTest
- Tests for the update system functionality.
Code
function testUpdateAccess() {
// Try accessing update.php without the proper permission.
$regular_user = $this->backdropCreateUser();
$this->backdropLogin($regular_user);
$this->backdropGet($this->update_url, array('external' => TRUE));
$this->assertResponse(403);
// Try accessing update.php as an anonymous user.
$this->backdropLogout();
$this->backdropGet($this->update_url, array('external' => TRUE));
$this->assertResponse(403);
// Access the update page with the proper permission.
$this->backdropLogin($this->update_user);
$this->backdropGet($this->update_url, array('external' => TRUE));
$this->assertResponse(200);
// Access the update page as user 1.
$user1 = user_load(1);
$user1->pass_raw = user_password();
require_once BACKDROP_ROOT . '/' . settings_get('password_inc', 'core/includes/password.inc');
$user1->pass = $user1->pass_raw;
user_save($user1);
$this->backdropLogin($user1);
$this->backdropGet($this->update_url, array('external' => TRUE));
$this->assertResponse(200);
}