diff --git modules/simpletest/tests/common.test modules/simpletest/tests/common.test index ca29e11..59d1def 100644 --- modules/simpletest/tests/common.test +++ modules/simpletest/tests/common.test @@ -2079,6 +2079,53 @@ class DrupalSystemListingTestCase extends DrupalWebTestCase { } } + +/** + * Tests for the drupal_get_path() function. + */ +class DrupalGetPathUnitTest extends DrupalWebTestCase { + public static function getInfo() { + return array( + 'name' => 'Drupal get path', + 'description' => 'Perform unit tests on the drupal_get_path() function.', + 'group' => 'System', + ); + } + + /** + * Tests that drupal_get_path() function returns sensible results. + */ + function testDrupalGetPath() { + $paths = array( + array( + 'type' => 'theme', + 'name' => 'test_theme', + 'expected' => 'themes/tests/test_theme', + ), + array( + 'type' => 'theme_engine', + 'name' => 'phptemplate', + 'expected' => 'themes/engines/phptemplate', + ), + array( + 'type' => 'module', + 'name' => 'simpletest', + 'expected' => 'modules/simpletest', + ), + array( + 'type' => 'profile', + 'name' => 'standard', + 'expected' => 'profiles/standard', + ), + ); + + foreach ($paths as $path) { + $this->assertEqual(drupal_get_path($path['type'], $path['name']), $path['expected'], t('Component @name of type @type was found at @path', array('@name' => $path['name'], '@type' => $path['type'], '@path' => $path['expected']))); + } + + } +} + /** * Tests for the format_date() function. */