protected function loadAssets()
 {
     // sfYaml
     require_once dirname(__FILE__) . '/vendor/sfYaml/sfYaml.php';
     // sfTemplating
     require_once dirname(__FILE__) . '/vendor/sfTemplating/sfTemplateAutoloader.php';
     sfTemplateAutoloader::register();
 }
<?php

/*
 * This file is part of the symfony package.
 *
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../lib/lime/lime.php';
require_once dirname(__FILE__) . '/../../lib/sfTemplateAutoloader.php';
sfTemplateAutoloader::register();
$t = new lime_test(2);
$renderer = new sfTemplateRendererPhp();
// ->evaluate()
$t->diag('->evaluate()');
$template = new sfTemplateStorageString('<?php echo $foo ?>');
$t->is($renderer->evaluate($template, array('foo' => 'bar')), 'bar', '->evaluate() renders templates that are instances of sfTemplateStorageString');
$template = new sfTemplateStorageFile(dirname(__FILE__) . '/fixtures/templates/foo.php');
$t->is($renderer->evaluate($template, array('foo' => 'bar')), 'bar', '->evaluate() renders templates that are instances of sfTemplateStorageFile');
<?php

/*
 * This file is part of the symfony package.
 *
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once dirname(__FILE__) . '/../lib/lime/lime.php';
require_once dirname(__FILE__) . '/../../lib/sfTemplateAutoloader.php';
sfTemplateAutoloader::register();
$t = new lime_test(3);
// ->autoload()
$t->diag('->autoload()');
$t->ok(!class_exists('Foo'), '->autoload() does not try to load classes that does not begin with sfTemplate');
$autoloader = new sfTemplateAutoloader();
$t->is($autoloader->autoload('sfTemplateEngine'), true, '->autoload() returns true if it is able to load a class');
$t->is($autoloader->autoload('Foo'), false, '->autoload() returns false if it is not able to load a class');
示例#4
0
 /**
  * Initialise le moteur de templates.
  *
  * @return void
  */
 public function initTplEngine()
 {
     require_once OKT_VENDOR_PATH . '/sfTemplating/sfTemplateAutoloader.php';
     sfTemplateAutoloader::register();
     $loader = new sfTemplateLoaderFilesystem($this->aTplDirectories);
     $this->tpl = new oktTemplating($loader);
 }