public function doLoad($template, $renderer = 'php')
        {
            $this->loaded = true;
            if ('invalidBool' === $template) {
                return false;
            } elseif ('invalidInt' === $template) {
                return 0;
            } elseif ('invalidString' === $template) {
                return '';
            }
            return 'valid';
        }
    }
}
$context = createContext();
$view = new sfTemplatingComponentView($context, 'module', 'action', '');
$loader = new myLoader($view, $context, array('key' => 'value'));
$t->diag('->configure()');
$t->is($loader->configured, true, '->configure() is executed in the constructor');
$t->diag('->getParameter()');
$t->is($loader->getParameter('key'), 'value', '->getParameter() returns the value of the specified parameter');
$t->is($loader->getParameter('unknown-key'), null, '->getParameter() returns null if the specified parameter does not exist');
$t->is($loader->getParameter('unknown-key', 'default'), 'default', '->getParameter() returns the specified default value');
$t->diag('->doLoad()');
$t->is($loader->loaded, false, '->doLoad() is not executed in the constructor');
$loader->load('test');
$t->is($loader->loaded, true, '->doLoad() is executed in the load() method');
$t->ok($loader->load('invalidBool') === false, '->laod() returns false if the doLoad() method returns false');
$t->ok($loader->load('invalidInt') === false, '->laod() returns false if the doLoad() method returns 0');
$t->ok($loader->load('invalidString') === false, '->laod() returns false if the doLoad() method returns empty string');
$t->ok($loader->load('valid') === 'valid', '->laod() returns true if the doLoad() method returns string');
        $context = sfContext::getInstance(array('request' => 'sfWebRequest', 'response' => 'sfWebResponse'), true);
        $context->configuration = new ApplicationConfigurationMock();
        sfConfig::set('sf_standard_helpers', array('Text'));
        return $context;
    }
    class myLoader extends sfTemplateSwitchableLoaderFilesystemForSymfony1
    {
        public function getTemplateDirs()
        {
            return $this->templateDirs;
        }
    }
}
$fixtureDir = realpath(dirname(__FILE__) . '/../fixtures');
$context = createContext();
$view = new sfTemplatingComponentView($context, 'module', 'action', '');
$loader = new myLoader($view, $context);
$loaderWithExt = new myLoader($view, $context, array('extension' => '.php'));
$loaderWithWrongExt = new myLoader($view, $context, array('extension' => '.unknown'));
$globalView = new sfTemplatingComponentView($context, 'global', '', '');
$globalLoader = new myLoader($globalView, $context);
$t->diag('->configure()');
$t->ok(in_array($fixtureDir . '/template/%name%.%extension%', $loader->getTemplateDirs()), '->configure() sets valid global template path');
$t->diag('->doLoad()');
$t->is((string) $loader->load('actionSuccess'), $fixtureDir . '/module/actionSuccess.php', '->doLoad() loads the specified local template');
$t->is((string) $loader->load('actionSuccess', 'php'), $fixtureDir . '/module/actionSuccess.php', '->doLoad() loads the specified local template with renderer');
$t->is((string) $loaderWithExt->load('actionSuccess'), $fixtureDir . '/module/actionSuccess.php', '->doLoad() loads the specified local template with extension');
$t->is($loader->load('unknownSuccess'), false, '->doLoad() returns false if the specified local template is not exists');
$t->is($loaderWithWrongExt->load('actionSuccess'), false, '->doLoad() returns false if the specified local template is exists but its extension is wrong');
$t->is((string) $globalLoader->load('layout'), $fixtureDir . '/template/layout.php', '->doLoad() loads the specified global template');
$t->is($loader->load('actionSuccess', 'original')->getRenderer(), 'original', '->load() returns template that has specified renderer');