1 bootstrap.test | BootstrapGetFilenameTestCase::testBackdropGetFilename() |
Test that backdrop_get_filename() works correctly when the file is not found in the database.
File
- core/
modules/ simpletest/ tests/ bootstrap.test, line 502
Class
- BootstrapGetFilenameTestCase
- Test backdrop_get_filename()'s availability.
Code
function testBackdropGetFilename() {
// Reset the static cache so we can test the "db is not active" code of
// backdrop_get_filename().
backdrop_static_reset('backdrop_get_filename');
// Retrieving the location of a module.
$this->assertIdentical(backdrop_get_filename('module', 'block'), 'core/modules/block/block.module', t('Retrieve module location.'));
// Retrieving the location of a theme.
$this->assertIdentical(backdrop_get_filename('theme', 'stark'), 'core/themes/stark/stark.info', t('Retrieve theme location.'));
// Retrieving the location of a theme engine.
$this->assertIdentical(backdrop_get_filename('theme_engine', 'phptemplate'), 'core/themes/engines/phptemplate/phptemplate.engine', t('Retrieve theme engine location.'));
// Retrieving the location of a layout.
$this->assertIdentical(backdrop_get_filename('layout', 'boxton'), 'core/layouts/boxton/boxton.info', t('Retrieve layout location.'));
// Retrieving the location of a profile. Profiles are a special case with
// a fixed location and naming.
$this->assertIdentical(backdrop_get_filename('profile', 'standard'), 'core/profiles/standard/standard.profile', t('Retrieve install profile location.'));
// When a file is not found in the database cache, backdrop_get_filename()
// searches several locations on the filesystem, including the core/
// directory. We use the '.script' extension below because this is a
// non-existent filetype that will definitely not exist in the database.
// Since there is already a core/scripts directory, backdrop_get_filename()
// will automatically check there for 'script' files, just as it does
// for (e.g.) 'module' files in core/modules.
$this->assertIdentical(backdrop_get_filename('script', 'test'), 'core/scripts/test.script', t('Retrieve test script location.'));
}