t('legacy.inc'), 'description' => t('Test legacy.inc redirects.'), 'group' => 'API Module', ); } function testApiLegacy() { $tests = array( // Function array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('sample_function', 'function', ''), 'redirect' => 'api/test/sample.php/function/sample_function/6', ), array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('sample_function', 'function', '6'), 'redirect' => 'api/test/sample.php/function/sample_function/6', ), // Constant array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('SAMPLE_CONSTANT', 'constant', ''), 'redirect' => 'api/test/sample.php/constant/SAMPLE_CONSTANT/6', ), array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('SAMPLE_CONSTANT', 'constant', '6'), 'redirect' => 'api/test/sample.php/constant/SAMPLE_CONSTANT/6', ), // Global array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('sample_global', 'global', ''), 'redirect' => 'api/test/sample.php/global/sample_global/6', ), array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('sample_global', 'global', '6'), 'redirect' => 'api/test/sample.php/global/sample_global/6', ), // Topic array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('samples', 'group', ''), 'redirect' => 'api/test/sample.php/group/samples/6', ), array( 'function' => 'api_legacy_1_2_object_load', 'arguments' => array('samples', 'group', '6'), 'redirect' => 'api/test/sample.php/group/samples/6', ), ); include_once './' . drupal_get_path('module', 'api') . '/legacy.inc'; foreach ($tests as $test) { $result = call_user_func_array($test['function'], $test['arguments']); $this->assertEqual($result, $test['redirect'], $test['function'] . ': ' . implode(', ', $test['arguments']) . ' Got: ' . check_plain($result) . ''); } } }