summaryrefslogtreecommitdiff
path: root/modules/simpletest/tests
diff options
context:
space:
mode:
Diffstat (limited to 'modules/simpletest/tests')
-rw-r--r--modules/simpletest/tests/system_test.module48
1 files changed, 48 insertions, 0 deletions
diff --git a/modules/simpletest/tests/system_test.module b/modules/simpletest/tests/system_test.module
index 76d2701cf..4d7042e72 100644
--- a/modules/simpletest/tests/system_test.module
+++ b/modules/simpletest/tests/system_test.module
@@ -16,6 +16,12 @@ function system_test_menu() {
'access callback' => TRUE,
'type' => MENU_CALLBACK,
);
+ $items['system-test/authorize-init/%'] = array(
+ 'page callback' => 'system_test_authorize_init_page',
+ 'page arguments' => array(2),
+ 'access arguments' => array('administer software updates'),
+ 'type' => MENU_CALLBACK,
+ );
$items['system-test/redirect/%'] = array(
'title' => 'Redirect',
'page callback' => 'system_test_redirect',
@@ -311,3 +317,45 @@ function _system_test_second_shutdown_function($arg1, $arg2) {
throw new Exception('Drupal is <blink>awesome</blink>.');
}
+/**
+ * Implements hook_filetransfer_info().
+ */
+function system_test_filetransfer_info() {
+ return array(
+ 'system_test' => array(
+ 'title' => t('System Test FileTransfer'),
+ 'file' => 'system_test.module', // Should be a .inc, but for test, ok.
+ 'class' => 'SystemTestFileTransfer',
+ 'weight' => -10,
+ ),
+ );
+}
+
+/**
+ * Mock FileTransfer object to test the settings form functionality.
+ */
+class SystemTestFileTransfer {
+ public static function factory() {
+ return new SystemTestFileTransfer;
+ }
+
+ public function getSettingsForm() {
+ $form = array();
+ $form['system_test_username'] = array(
+ '#type' => 'textfield',
+ '#title' => t('System Test Username'),
+ );
+ return $form;
+ }
+}
+
+/**
+ * Page callback to initialize authorize.php during testing.
+ *
+ * @see system_authorized_init().
+ */
+function system_test_authorize_init_page($page_title) {
+ $authorize_url = $GLOBALS['base_url'] . '/authorize.php';
+ system_authorized_init('system_test_authorize_run', drupal_get_path('module', 'system_test') . '/system_test.module', array(), $page_title);
+ drupal_goto($authorize_url);
+}