示例#1
0
 /**
  * Prepare a virtual filesystem for testing.
  */
 protected function setUp()
 {
     // @codeCoverageIgnoreStart
     if (!$this->_started) {
         $config = parse_ini_file(dirname(__FILE__) . '/../../paths.ini', true);
         require_once $config['Opl'] . 'Opl/Class.php';
         Opl_Loader::register();
         $this->_started = true;
     }
     vfsStreamWrapper::register();
     vfsStreamWrapper::setRoot($root = new vfsStreamDirectory('libs'));
     $root->addChild(new vfsStreamDirectory('Foo'));
     $root->addChild(new vfsStreamDirectory('Bar'));
     $root->addChild(new vfsStreamDirectory('Joe'));
     $root->addChild(new vfsStreamDirectory('NewLib'));
     $root->addChild(new vfsStreamDirectory('Opl'));
     $root->addChild($this->_createFile('Bar.php', 'BAR.PHP'));
     // Contents of Opl/
     $root->getChild('Opl')->addChild(vfsStream::newFile('Test.php')->withContent(''));
     // Contents of NewLib/
     $root->getChild('NewLib')->addChild($this->_createFile('Class.php', 'NEWLIB/CLASS.PHP'));
     $root->getChild('NewLib')->addChild($this->_createFile('Foo.php', 'NEWLIB/FOO.PHP'));
     // Contents of Joe/
     $root->getChild('Joe')->addChild($this->_createFile('Class.php', 'JOE/CLASS.PHP'));
     $root->getChild('Joe')->addChild($this->_createFile('Foo.php', 'JOE/FOO.PHP'));
     $root->getChild('Joe')->addChild($this->_createFile('Bar.php', 'JOE/BAR.PHP'));
     $root->getChild('Joe')->addChild($this->_createFile('Exception.php', 'JOE/EXCEPTION.PHP'));
     $root->getChild('Joe')->addChild(new vfsStreamDirectory('Foo'));
     $root->getChild('Joe/Foo')->addChild($this->_createFile('Exception.php', 'JOE/FOO/EXCEPTION.PHP'));
     // Contents of Bar/
     $root->getChild('Bar')->addChild($this->_createFile('Class.php', 'BAR/CLASS.PHP'));
     // Contents of Foo/
     $root->getChild('Foo')->addChild($this->_createFile('Bar.php', 'FOO/BAR.PHP'));
     $root->getChild('Foo')->addChild($this->_createFile('Class.php', 'FOO/CLASS.PHP'));
     // @codeCoverageIgnoreStop
 }
<?php

require_once 'PHPUnit/Framework.php';
if (!defined('GROUPED')) {
    $config = parse_ini_file('../paths.ini', true);
    require $config['libraries']['Opl'] . 'Base.php';
    Opl_Loader::loadPaths($config);
    Opl_Loader::register();
}
class tl implements Opl_Translation_Interface
{
    public function _($group, $id)
    {
    }
    public function assign($group, $id)
    {
    }
}
// end tl;
class expressionTest extends PHPUnit_Framework_TestCase
{
    protected $tpl;
    protected $cpl;
    protected function setUp()
    {
        $tpl = new Opt_Class();
        $tpl->sourceDir = '/';
        $tpl->sourceDir = './templates/';
        $tpl->compileDir = './templates_c/';
        $tpl->escape = false;
        $tpl->register(Opt_Class::PHP_FUNCTION, '_', '_');
示例#3
0
<?php

/**
 * The bootstrap file for unit tests.
 *
 * @author Tomasz "Zyx" Jędrzejewski
 * @copyright Copyright (c) 2009-2010 Invenzzia Group
 * @license http://www.invenzzia.org/license/new-bsd New BSD License
 */
$config = parse_ini_file(dirname(__FILE__) . '/../paths.ini', true);
require $config['libraries']['Opl'] . 'Opl/Loader.php';
$loader = new Opl_Loader('_');
$loader->addLibrary('Opl', $config['libraries']['Opl']);
$loader->register();