1210
1210
// passed properly through the call stack and being handled correctly by a 'known'
1211
1211
// token, [node:title].
1212
1212
$this->assertFalse(strcmp($target, $result), t('Basic placeholder tokens replaced.'));
1214
1214
$raw_tokens = array('title' => '[node:title]');
1215
1215
$generated = token_generate('node', $raw_tokens, array('node' => $node));
1216
1216
$this->assertFalse(strcmp($generated['[node:title]'], check_plain($node->title)), t('Token sanitized.'));
1290
1290
$this->assertEqual($parsed, $expected, t('Entire parsed .info string and expected array are identical.'));
1295
* Tests for the update system functionality.
1297
class UpdateScriptFunctionalTest extends DrupalWebTestCase {
1298
private $update_url;
1299
private $update_user;
1301
public static function getInfo() {
1303
'name' => 'Update functionality',
1304
'description' => 'Tests the update script access and functionality.',
1305
'group' => 'System',
1311
$this->update_url = $GLOBALS['base_url'] . '/update.php';
1312
$this->update_user = $this->drupalCreateUser(array('administer software updates'));
1316
* Tests access to the update script.
1318
function testUpdateAccess() {
1319
// Try accessing update.php without the proper permission.
1320
$regular_user = $this->drupalCreateUser();
1321
$this->drupalLogin($regular_user);
1322
$this->drupalGet($this->update_url, array('external' => TRUE));
1323
$this->assertResponse(403);
1325
// Try accessing update.php as an anonymous user.
1326
$this->drupalLogout();
1327
$this->drupalGet($this->update_url, array('external' => TRUE));
1328
$this->assertResponse(403);
1330
// Access the update page with the proper permission.
1331
$this->drupalLogin($this->update_user);
1332
$this->drupalGet($this->update_url, array('external' => TRUE));
1333
$this->assertResponse(200);
1335
// Access the update page as user 1.
1336
$user1 = user_load(1);
1337
$user1->pass_raw = user_password();
1338
require_once DRUPAL_ROOT . '/' . variable_get('password_inc', 'includes/password.inc');
1339
$user1->pass = user_hash_password(trim($user1->pass_raw));
1340
db_query("UPDATE {users} SET pass = :pass WHERE uid = :uid", array(':pass' => $user1->pass, ':uid' => $user1->uid));
1341
$this->drupalLogin($user1);
1342
$this->drupalGet($this->update_url, array('external' => TRUE));
1343
$this->assertResponse(200);