diff --git a/tests/api_objects.test b/tests/api_objects.test index 194c369..2022aa8 100644 --- a/tests/api_objects.test +++ b/tests/api_objects.test @@ -21,7 +21,7 @@ class ApiBranchCreation extends ApiTestCase { // Make sure we have the right number of doc objects. $branch = $this->getBranch(); $count = db_result(db_query("SELECT count(*) FROM {api_documentation} WHERE branch_id = %d", $branch->branch_id)); - $this->assertEqual($count, 26, 'Found ' . $count . ' documentation objects.'); + $this->assertEqual($count, 32, 'Found ' . $count . ' documentation objects.'); // Check sample.php $object = api_filename_load('sample.php', $branch->project, $branch->branch_name); diff --git a/tests/sample/sample.php b/tests/sample/sample.php index 9c5318b..1811f8b 100644 --- a/tests/sample/sample.php +++ b/tests/sample/sample.php @@ -68,6 +68,10 @@ function sample_function($parameter, $complex_parameter) { } /** + * @} end samples + */ + +/** * Function that has classes for parameter and return value. * * @param SubSample $parameter @@ -75,15 +79,13 @@ function sample_function($parameter, $complex_parameter) { * * @return SampleInterface * This return value should link to the interface. + * + * @ingroup samples */ function sample_class_function($parameter) { } /** - * @} end samples - */ - -/** * For testing duplicate function name linking. */ function duplicate_function() { @@ -93,3 +95,71 @@ function duplicate_function() { * For testing duplicate constant linking. */ define('DUPLICATE_CONSTANT'); + +/** + * Respond to sample updates. + * + * This hook is for testing hook linking. + */ +function hook_sample_name() { +} + +/** + * Returns HTML for a sample. + * + * This theme function is for testing linking in theme(). + * + * @param $variables + * An associative array containing: + * - foo: The foo object that is being formatted. + * - show_bar: TRUE to show the bar component, FALSE to omit it. + */ +function theme_sample_one($variables) { +} + +/** + * Returns HTML for another sample. + * + * This theme function is for testing linking in theme(). It should not be + * linked, because of the sample-two.tpl.php file, which has higher priority. + * + * @param $variables + * An associative array containing: + * - foo: The foo object that is being formatted. + * - show_bar: TRUE to show the bar component, FALSE to omit it. + */ +function theme_sample_two($variables) { +} + +/** + * Does something interesting, to test in-code linking. + */ +function sample_in_code_links() { + // Should link to function. + $foo = sample_function(); + // Should link to theme function. + $bar = theme('sample_one', $foo); + // Should link to theme template, not function, though both exist. + $baz = theme('sample_two', $foo); + // Should link to theme template. + $boo = theme('sample_three'); + // Should link to hook. + $x = module_invoke_all('sample_name', $foo, $baz); + $stuff = ''; + // Should link to hook. + foreach (module_implements('sample_name') as $mod) { + // Should link to hook. + module_invoke($mod, 'sample_name', $baz); + } + + // Should link to search for this function. + $z = duplicate_function(); + + // Should link to class. + $j = new SubSample(); + + // Should link to constant. + $k = SAMPLE_CONSTANT; + // Should link to search for this constant. + $l = DUPLICATE_CONSTANT; +}