You are here

class BackupMigrateFunctionalityTest in Backup and Migrate 5

Same name and namespace in other branches
  1. 6.3 tests/backup_migrate.functionality.test \BackupMigrateFunctionalityTest
  2. 6.2 tests/backup_migrate.functionality.test \BackupMigrateFunctionalityTest

Unit tests for Backup and Migrate module.

Hierarchy

Expanded class hierarchy of BackupMigrateFunctionalityTest

File

tests/BackupMigrateFunctionalityTest.test, line 7

View source
class BackupMigrateFunctionalityTest extends DrupalTestCase {

  /**
   * Drupal SimpleTest method: return metadata about the test.
   */
  function get_info() {
    return array(
      'name' => t('Backup and Migrate Functionality'),
      'desc' => t('Executes the functionality test suite for backup and migrate.'),
      'group' => t('Backup and Migrate module'),
    );
  }
  var $admin_user;
  var $directory_backup;

  /**
   * SimpleTest core method: code run before each and every test method.
   */
  function setUp() {
    parent::setUp();

    // Create an administrative user with permission to do all functions
    $permissions = array(
      'perform backup',
      'access backup files',
      'delete backup files',
      'restore from backup',
    );
    $this->admin_user = $this
      ->drupalCreateUserRolePerm($permissions);

    // move the existing backup dir out of the way
    $directory = _backup_migrate_get_save_path();
    if (is_dir($directory)) {
      $this->directory_backup = $directory . $this
        ->randomName(5, '_');
      rename($directory, $this->directory_backup);
    }
  }

  /**
   * SimpleTest core method: code run after each and every test method.
   */
  function tearDown() {

    //
    if ($this->directory_backup) {
      $directory = _backup_migrate_get_save_path();
      $this
        ->delete_directory(_backup_migrate_get_save_path());
      rename($this->directory_backup, $directory);
    }
    parent::tearDown();
  }
  function testManualBackup() {
    $directory = _backup_migrate_get_save_path();
    $edit = array(
      'backup_migrate_file_name' => $this
        ->randomName(5, 'backup'),
      'backup_migrate_exclude_tables[]' => array(),
      'backup_migrate_nodata_tables[]' => array(),
      'backup_migrate_compression' => "none",
      'backup_migrate_timestamp_format' => '',
      'backup_migrate_destination' => "save",
      'backup_migrate_append_timestamp' => false,
      'backup_migrate_save_settings' => false,
    );
    $this
      ->drupalLoginUser($this->admin_user);
    $this
      ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
    $this
      ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql'), t("Checking that a backup file was created", array(
      '!key' => $key,
    )));
    $edit['backup_migrate_compression'] = 'gzip';
    $this
      ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
    $this
      ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql.gz'), t("Checking that a backup file was created", array(
      '!key' => $key,
    )));
    $edit['backup_migrate_compression'] = 'bzip';
    $this
      ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
    $this
      ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql.bz'), t("Checking that a backup file was created", array(
      '!key' => $key,
    )));
    $edit['backup_migrate_compression'] = 'zip';
    $this
      ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));
    $this
      ->assertTrue(file_exists($directory . "/manual/" . $edit['backup_migrate_file_name'] . '.sql.zip'), t("Checking that a backup file was created", array(
      '!key' => $key,
    )));
    $this
      ->delete_directory($directory);
  }
  function testSaveDefaultSettings() {
    $directory = _backup_migrate_get_save_path();
    $tables = _backup_migrate_get_table_names();
    $edit = array(
      'backup_migrate_file_name' => $this
        ->randomName(5, 'backup'),
      'backup_migrate_exclude_tables[]' => $tables,
      'backup_migrate_nodata_tables[]' => $tables,
      'backup_migrate_compression' => "gzip",
      'backup_migrate_timestamp_format' => 'Y-m-d',
      'backup_migrate_destination' => "download",
      'backup_migrate_append_timestamp' => false,
      'backup_migrate_save_settings' => true,
    );
    foreach ($edit as $key => $value) {
      $this
        ->drupalVariableSet($key, NULL);
    }
    $this
      ->drupalLoginUser($this->admin_user);
    $this
      ->drupalPostRequest("admin/content/backup_migrate", $edit, t('Backup Database'));

    // load vars from db (becuase they were saved by a seperate thread, they are not available to variable_get)
    $vars = variable_init();
    unset($edit['backup_migrate_save_settings']);
    foreach ($edit as $key => $value) {
      $key = str_replace("[]", '', $key);
      $this
        ->assertEqual($vars[$key], $value, t('Checking that the variable !var was set', array(
        '!var' => $key,
      )));
    }
    $this
      ->drupalGet(url("logout", NULL, NULL, TRUE));
    $this
      ->delete_directory($directory);
  }
  function testListSavedBackups() {
    $types = array(
      'manual' => "admin/content/backup_migrate/files",
      'scheduled' => "admin/content/backup_migrate/files/scheduled",
    );
    foreach ($types as $type => $url) {
      $directory = _backup_migrate_check_destination_dir($type);

      // add some files
      $valid_extensions = array(
        ".sql",
        ".gz",
        ".bz",
        ".zip",
      );
      $invalid_extensions = array(
        ".txt",
        ".doc",
        ".svn",
        ".abc",
        ".xyz",
        "",
      );
      $files = array();
      for ($i = 0; $i < 4; $i++) {
        $valid = $i % 2 == 0;
        if ($valid) {
          $file = $this
            ->randomName(rand(1, 64), '') . $valid_extensions[array_rand($valid_extensions)];
        }
        else {
          $file = $this
            ->randomName(rand(1, 64), '') . $invalid_extensions[array_rand($invalid_extensions)];
        }
        $path = $directory . "/" . $file;
        $size = rand(10, 100);
        file_put_contents($path, $this
          ->randomName($size, ''));
        $files[] = array(
          'name' => $file,
          'path' => $directory . "/" . $file,
          'size' => format_size($size),
          'time' => date("m/d/Y h:i a", filectime($path)),
          'valid' => $valid,
        );
      }

      // check access only permissions
      $permissions = array(
        'access backup files',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url($url, NULL, NULL, TRUE));
      foreach ($files as $file) {
        if (!$file['valid']) {
          $this
            ->assertNoText($file['name'], t("checking that an invalid file is not in the file list"));
        }
        else {
          $this
            ->assertText($file['name'], t("checking that a valid file name (!text) is in the file list", array(
            "!text" => $file['name'],
          )));
          $this
            ->assertText($file['size'], t("checking that a valid file size (!text) is in the file list", array(
            "!text" => $file['size'],
          )));
          $this
            ->assertText($file['time'], t("checking that a valid file time (!text) is in the file list", array(
            "!text" => $file['time'],
          )));
          $this
            ->assertWantedRaw(l("download", "system/files/" . $file['path']), t("checking that the download link is in the file list"));
          $this
            ->assertNoUnwantedRaw(l("restore", "admin/content/backup_migrate/restorefile/" . $file['path']), t("checking that the restore link is not in the file list"));
          $this
            ->assertNoUnwantedRaw(l("delete", "admin/content/backup_migrate/delete/" . $file['path']), t("checking that the delete link is not in the file list"));
        }
      }
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));

      // check restore permissions
      $permissions = array(
        'access backup files',
        'restore from backup',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url($url, NULL, NULL, TRUE));
      foreach ($files as $file) {
        if (!$file['valid']) {
          $this
            ->assertNoText($file['name'], t("checking that an invalid file is not in the file list"));
        }
        else {
          $this
            ->assertText($file['name'], t("checking that a valid file name (!text) is in the file list", array(
            "!text" => $file['name'],
          )));
          $this
            ->assertText($file['size'], t("checking that a valid file size (!text) is in the file list", array(
            "!text" => $file['size'],
          )));
          $this
            ->assertText($file['time'], t("checking that a valid file time (!text) is in the file list", array(
            "!text" => $file['time'],
          )));
          $this
            ->assertWantedRaw(l("download", "system/files/" . $file['path']), t("checking that the download link is in the file list"));
          $this
            ->assertWantedRaw(l("restore", "admin/content/backup_migrate/restorefile/" . $file['path']), t("checking that the restore link is not in the file list"));
          $this
            ->assertNoUnwantedRaw(l("delete", "admin/content/backup_migrate/delete/" . $file['path']), t("checking that the delete link is not in the file list"));
        }
      }
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));

      // check delete permissions
      $permissions = array(
        'access backup files',
        'delete backup files',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url($url, NULL, NULL, TRUE));
      foreach ($files as $file) {
        if (!$file['valid']) {
          $this
            ->assertNoText($file['name'], t("checking that an invalid file is not in the file list"));
        }
        else {
          $this
            ->assertText($file['name'], t("checking that a valid file name (!text) is in the file list", array(
            "!text" => $file['name'],
          )));
          $this
            ->assertText($file['size'], t("checking that a valid file size (!text) is in the file list", array(
            "!text" => $file['size'],
          )));
          $this
            ->assertText($file['time'], t("checking that a valid file time (!text) is in the file list", array(
            "!text" => $file['time'],
          )));
          $this
            ->assertWantedRaw(l("download", "system/files/" . $file['path']), t("checking that the download link is in the file list"));
          $this
            ->assertNoUnwantedRaw(l("restore", "admin/content/backup_migrate/restorefile/" . $file['path']), t("checking that the restore link is not in the file list"));
          $this
            ->assertWantedRaw(l("delete", "admin/content/backup_migrate/delete/" . $file['path']), t("checking that the delete link is not in the file list"));
        }
      }
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));
    }
    $this
      ->delete_directory(_backup_migrate_get_save_path());
  }
  function testDownloadBackup() {
    $types = array(
      'manual' => "admin/content/backup_migrate/files",
      'scheduled' => "admin/content/backup_migrate/files/scheduled",
    );
    foreach ($types as $type => $url) {
      $directory = _backup_migrate_check_destination_dir($type);

      // add a file
      $file = $this
        ->randomName(rand(1, 64), '') . ".sql";
      $path = $directory . "/" . $file;
      $size = rand(10, 100);
      $contents = $this
        ->randomName($size, '');
      file_put_contents($path, $contents);
      $direct_url = $GLOBALS['base_url'] . '/' . $path;
      $private_url = url('system/files/' . $path, NULL, NULL, TRUE);

      // check logged out user
      $this
        ->drupalVariableSet('file_downloads', FILE_DOWNLOADS_PUBLIC);
      $this
        ->drupalGet(url($direct_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url($private_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalVariableSet('file_downloads', FILE_DOWNLOADS_PRIVATE);
      $this
        ->drupalGet(url($direct_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url($private_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));

      // check no access perms
      $permissions = array();
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalVariableSet('file_downloads', FILE_DOWNLOADS_PUBLIC);
      $this
        ->drupalGet(url($direct_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url($private_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalVariableSet('file_downloads', FILE_DOWNLOADS_PRIVATE);
      $this
        ->drupalGet(url($direct_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url($private_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));
      $permissions = array(
        'access backup files',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url($url, NULL, NULL, TRUE));
      $this
        ->drupalVariableSet('file_downloads', FILE_DOWNLOADS_PUBLIC);
      $this
        ->drupalGet(url($direct_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url($private_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "200",
      ), t("Checking that the user was not access denied"));
      $this
        ->assertHeader("Content-Disposition", 'attachment; filename="' . $file . '"');
      $this
        ->assertText($contents);
      $this
        ->drupalVariableSet('file_downloads', FILE_DOWNLOADS_PRIVATE);
      $this
        ->drupalGet(url($direct_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url($private_url, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "200",
      ), t("Checking that the user was not access denied"));
      $this
        ->assertHeader("Content-Disposition", 'attachment; filename="' . $file . '"');
      $this
        ->assertText($contents);
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));
    }
  }
  function testDeleteBackup() {
    foreach (array(
      'manual',
      'scheduled',
    ) as $type) {
      $directory = _backup_migrate_check_destination_dir($type);
      $file = $directory . "/" . $this
        ->randomName(rand(1, 64), '') . '.sql';
      file_put_contents($file, $this
        ->randomName(100, ''));
      $this
        ->assertTrue(file_exists($file), t("Reality checking that the test file was created"));

      // user without delete access
      // check access only permissions
      $permissions = array(
        'access backup files',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url("admin/content/backup_migrate/delete/" . $file, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->assertTrue(file_exists($file), t("Checking that the backup file was not deleted"));
      $this
        ->post(url("admin/content/backup_migrate/delete/" . $file, NULL, NULL, TRUE), array(
        'confirm' => 1,
      ));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->assertTrue(file_exists($file), t("Checking that the backup file was not deleted"));
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));

      // user with delete access
      // check access only permissions
      $permissions = array(
        'access backup files',
        'delete backup files',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url("admin/content/backup_migrate/delete/" . $file, NULL, NULL, TRUE));
      $this
        ->assertWantedRaw(t('Are you sure you want to delete the backup file at %path?', array(
        '%path' => $file,
      )), t("checking a confirmation message is displayed"));
      $this
        ->assertSubmit(t("Delete"), t('Checking that the delete button is there'));
      $this
        ->assertTrue(file_exists($file), t("Checking that the backup file was not deleted"));
      $this
        ->drupalPostRequest("admin/content/backup_migrate/delete/" . $file, array(), t('Delete'));

      // we should check that the module notifies the user that the file has been deleted.
      // only we can't, because the module doesn't actually do that... oops
      $this
        ->assertFalse(file_exists($file), t("Checking that the backup file was deleted"));
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));
    }
    $this
      ->delete_directory(_backup_migrate_get_save_path());
  }
  function testRestoreFromSaved() {
    foreach (array(
      'manual',
      'scheduled',
    ) as $type) {
      $directory = _backup_migrate_check_destination_dir($type);
      $file = $directory . "/" . $this
        ->randomName(rand(1, 64), '') . '.sql';
      $test_table = $this
        ->randomName(10, 'testtable_');
      file_put_contents($file, "CREATE TABLE {$test_table} (testid int(10));");
      $this
        ->assertTrue(file_exists($file), t("Reality checking that the test file was created"));

      // user without restore access
      // check access only permissions
      $permissions = array(
        'access backup files',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url("admin/content/backup_migrate/restorefile/" . $file, NULL, NULL, TRUE));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->post(url("admin/content/backup_migrate/restorefile/" . $file, NULL, NULL, TRUE), array(
        'confirm' => 1,
      ));
      $this
        ->assertResponse(array(
        "401",
        "403",
      ), t("Checking that the user was access denied"));
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));

      // user with restore access
      // check access only permissions
      $permissions = array(
        'access backup files',
        'restore from backup',
      );
      $user = $this
        ->drupalCreateUserRolePerm($permissions);
      $this
        ->drupalLoginUser($user);
      $this
        ->drupalGet(url("admin/content/backup_migrate/restorefile/" . $file, NULL, NULL, TRUE));
      $this
        ->assertWantedRaw(t('Are you sure you want to restore the database from the backup at %path?', array(
        '%path' => $file,
      )), t("checking a confirmation message is displayed"));
      $this
        ->assertSubmit(t("Restore"), t('Checking that the restore button is there'));
      $this
        ->drupalPostRequest("admin/content/backup_migrate/restorefile/" . $file, array(), t('Restore'));

      // check that the file was imported into the db
      $this
        ->assertTrue(in_array($test_table, _backup_migrate_get_table_names()), t("Checking that the test table is present."));
      $this
        ->drupalGet(url("logout", NULL, NULL, TRUE));
      db_query("DROP TABLE {$test_table};");
    }
    $this
      ->delete_directory(_backup_migrate_get_save_path());
  }
  function testRestoreFromUpload() {
    $directory = _backup_migrate_check_destination_dir($type);
    $file = file_directory_temp() . '/' . $this
      ->randomName(10, '') . '.sql';
    $test_table = $this
      ->randomName(10, 'testtable_');
    file_put_contents($file, "CREATE TABLE {$test_table} (testid int(10));");
    $this
      ->assertTrue(file_exists($file), t("Reality checking that the test file was created"));
    $edit = array();
    $edit['files[backup_migrate_restore_upload]'] = $file;

    // user without restore access
    // check access only permissions
    $permissions = array(
      'access backup files',
    );
    $user = $this
      ->drupalCreateUserRolePerm($permissions);
    $this
      ->drupalLoginUser($user);
    $this
      ->drupalGet(url("admin/content/backup_migrate/restore/", NULL, NULL, TRUE));
    $this
      ->assertResponse(array(
      "401",
      "403",
    ), t("Checking that the user was access denied"));
    $this
      ->post(url("admin/content/backup_migrate/restore/", NULL, NULL, TRUE), $edit);
    $this
      ->assertResponse(array(
      "401",
      "403",
    ), t("Checking that the user was access denied"));
    $this
      ->drupalGet(url("logout", NULL, NULL, TRUE));

    // user with restore access
    // check access only permissions
    $permissions = array(
      'access backup files',
      'restore from backup',
    );
    $user = $this
      ->drupalCreateUserRolePerm($permissions);
    $this
      ->drupalLoginUser($user);
    $this
      ->drupalGet(url("admin/content/backup_migrate/restore/", NULL, NULL, TRUE));
    $this
      ->assertSubmit(t("Restore Database"), t('Checking that the restore button is there'));
    $this
      ->drupalPostRequest("admin/content/backup_migrate/restore/", $edit, t('Restore Database'));

    // check that the file was imported into the db
    $this
      ->assertTrue(in_array($test_table, _backup_migrate_get_table_names()), t("Checking that the test table is present."));
    $this
      ->drupalGet(url("logout", NULL, NULL, TRUE));
    db_query("DROP TABLE {$test_table};");
  }

  // utlility functions
  function assertDrupalMessage($type, $drupal_message, $message) {
    foreach (@$_SESSION['messages'][$type] as $session_message) {
      if ($session_message == $drupal_message) {
        $this
          ->assertTrue(true, $message);
        return;
      }
    }
    $this
      ->assertTrue(false, $message);
  }
  function removeDrupalMessage($type, $drupal_message) {
    foreach (@$_SESSION['messages'][$type] as $key => $session_message) {
      if ($session_message == $drupal_message) {
        unset($_SESSION['messages'][$type][$key]);
      }
    }
  }
  function delete_directory($dirname) {
    if (is_dir($dirname) && ($dir_handle = opendir($dirname))) {
      while ($file = readdir($dir_handle)) {
        if ($file != '.' && $file != '..') {
          if (!is_dir($dirname . '/' . $file)) {
            unlink($dirname . '/' . $file);
          }
          else {
            $this
              ->delete_directory($dirname . '/' . $file);
          }
        }
      }
      closedir($dir_handle);
      rmdir($dirname);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
BackupMigrateFunctionalityTest::$admin_user property
BackupMigrateFunctionalityTest::$directory_backup property
BackupMigrateFunctionalityTest::assertDrupalMessage function
BackupMigrateFunctionalityTest::delete_directory function
BackupMigrateFunctionalityTest::get_info function Drupal SimpleTest method: return metadata about the test.
BackupMigrateFunctionalityTest::removeDrupalMessage function
BackupMigrateFunctionalityTest::setUp function SimpleTest core method: code run before each and every test method.
BackupMigrateFunctionalityTest::tearDown function SimpleTest core method: code run after each and every test method. Overrides DrupalTestCase::tearDown
BackupMigrateFunctionalityTest::testDeleteBackup function
BackupMigrateFunctionalityTest::testDownloadBackup function
BackupMigrateFunctionalityTest::testListSavedBackups function
BackupMigrateFunctionalityTest::testManualBackup function
BackupMigrateFunctionalityTest::testRestoreFromSaved function
BackupMigrateFunctionalityTest::testRestoreFromUpload function
BackupMigrateFunctionalityTest::testSaveDefaultSettings function
DrupalTestCase::$_cleanupModules property
DrupalTestCase::$_cleanupRoles property
DrupalTestCase::$_cleanupUsers property
DrupalTestCase::$_cleanupVariables property
DrupalTestCase::$_content property
DrupalTestCase::assertCopy function Will trigger a pass if both parameters refer to different objects. Fail otherwise.
DrupalTestCase::assertEqual function Will trigger a pass if the two parameters have the same value only. Otherwise a fail.
DrupalTestCase::assertError function Confirms that an error has occurred and optionally that the error text matches exactly.
DrupalTestCase::assertErrorPattern function Confirms that an error has occurred and that the error text matches a Perl regular expression.
DrupalTestCase::assertIdentical function Will trigger a pass if the two parameters have the same value and same type. Otherwise a fail.
DrupalTestCase::assertIsA function Type and class test. Will pass if class matches the type name or is a subclass or if not an object, but the type is correct.
DrupalTestCase::assertNoErrors function Confirms that no errors have occurred so far in the test method.
DrupalTestCase::assertNotA function Type and class mismatch test. Will pass if class name or underling type does not match the one specified.
DrupalTestCase::assertNotEqual function Will trigger a pass if the two parameters have a different value. Otherwise a fail.
DrupalTestCase::assertNotIdentical function Will trigger a pass if the two parameters have the different value or different type.
DrupalTestCase::assertNotNull function Will be true if the value is set.
DrupalTestCase::assertNoUnwantedPattern function Will trigger a pass if the Perl regex pattern is not present in subject. Fail if found.
DrupalTestCase::assertNoUnwantedRaw function Will trigger a pass if the raw text is NOT found on the loaded page Fail otherwise.
DrupalTestCase::assertNull function Will be true if the value is null.
DrupalTestCase::assertReference function Will trigger a pass if both parameters refer to the same object. Fail otherwise.
DrupalTestCase::assertWantedPattern function Will trigger a pass if the Perl regex pattern is found in the subject. Fail otherwise.
DrupalTestCase::assertWantedRaw function Will trigger a pass if the raw text is found on the loaded page Fail otherwise.
DrupalTestCase::clickLink function Follows a link by name. Will click the first link found with this link text by default, or a later one if an index is given. Match is case insensitive with normalised space. Does make assertations if the click was sucessful or not and it does…
DrupalTestCase::drupalCheckAuth function @abstract Checks to see if we need to send a http-auth header to authenticate when browsing a site.
DrupalTestCase::drupalCreateRolePerm function Create a role / perm combination specified by permissions
DrupalTestCase::drupalCreateUserRolePerm function Creates a user / role / permissions combination specified by permissions
DrupalTestCase::drupalGet function @abstract Brokder for the get function adds the authentication headers if necessary @author Earnest Berry III <earnest.berry@gmail.com>
DrupalTestCase::drupalGetContent function @TODO: needs documentation
DrupalTestCase::drupalLoginUser function Logs in a user with the internal browser
DrupalTestCase::drupalModuleDisable function Disables a drupal module
DrupalTestCase::drupalModuleEnable function Enables a drupal module
DrupalTestCase::drupalPostRequest function Do a post request on a drupal page. It will be done as usual post request with SimpleBrowser
DrupalTestCase::drupalRawPost function @abstract Broker for the post function adds the authentication headers if necessary @author Earnest Berry III <earnest.berry@gmail.com>
DrupalTestCase::DrupalTestCase function
DrupalTestCase::drupalVariableSet function Set a druapl variable and keep track of the changes for tearDown()
DrupalTestCase::randomName function Generates a random string, to be used as name or whatever
DrupalTestCase::run function Just some info for the reporter