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, '_', '_'); $tpl->register(Opt_Class::PHP_FUNCTION, 'foo', 'foo'); $tpl->register(Opt_Class::PHP_FUNCTION, 'bar', 'bar'); $tpl->register(Opt_Class::PHP_FUNCTION, 'joe', 'joe'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lol', 'lol'); $tpl->register(Opt_Class::PHP_FUNCTION, 'funct', 'funct'); $tpl->register(Opt_Class::PHP_FUNCTION, 'rotfl', 'rotfl'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao1', '#1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao2', '#2,1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao3', '#3,1,2:null#lmao'); $tpl->register(Opt_Class::PHP_CLASS, 'class', '_class'); $tpl->register(Opt_Class::PHP_CLASS, 'e', 'e'); $tpl->register(Opt_Class::PHP_CLASS, 'u', 'u'); $tpl->register(Opt_Class::PHP_CLASS, 'a', 'a'); Opl_Registry::register('opl_translate', new tl()); $tpl->setup(); $this->tpl = $tpl; $this->cpl = new Opt_Compiler_Class($tpl); }
/** * Configures the test case. */ public function setUp() { $tpl = new Opt_Class(); $tpl->sourceDir = '/'; $tpl->sourceDir = 'php://memory'; $tpl->compileDir = dirname(__FILE__) . '/../../Cache/'; $tpl->escape = false; $tpl->allowArrays = true; $tpl->allowObjects = true; $tpl->allowObjectCreation = true; $tpl->register(Opt_Class::PHP_FUNCTION, '_', '_'); $tpl->register(Opt_Class::PHP_FUNCTION, 'foo', 'foo'); $tpl->register(Opt_Class::PHP_FUNCTION, 'bar', 'bar'); $tpl->register(Opt_Class::PHP_FUNCTION, 'joe', 'joe'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lol', 'lol'); $tpl->register(Opt_Class::PHP_FUNCTION, 'funct', 'funct'); $tpl->register(Opt_Class::PHP_FUNCTION, 'rotfl', 'rotfl'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao1', '#1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao2', '#2,1#lmao'); $tpl->register(Opt_Class::PHP_FUNCTION, 'lmao3', '#3,1,2:null#lmao'); $tpl->register(Opt_Class::PHP_CLASS, 'class', '_class'); $tpl->register(Opt_Class::PHP_CLASS, 'e', 'e'); $tpl->register(Opt_Class::PHP_CLASS, 'u', 'u'); $tpl->register(Opt_Class::PHP_CLASS, 'a', 'a'); Opl_Registry::register('opl_translate', $this->getMock('Opl_Translation_Interface')); $tpl->setup(); $this->tpl = $tpl; $this->cpl = new Opt_Compiler_Class($tpl); }
/** * The class constructor - registers the main object in the * OPL registry. */ public function __construct() { if (Opl_Registry::exists('opc')) { throw new Opc_CannotCreateAnotherInstance_Exception(); } Opl_Registry::register('opc', $this); }
/** * @covers Opt_Class::setup */ public function testSetupRegistersTranslationInterface() { $this->_tpl->sourceDir = 'php://memory'; $this->_tpl->compileDir = 'php://memory'; Opl_Registry::register('opl_translate', null); Opl_Registry::register('opl_translate', $obj = $this->getMock('Opl_Translation_Interface')); $this->_tpl->setup(); $this->assertSame($obj, $this->_tpl->getTranslationInterface()); }
/** * @covers Opf_Class::setTranslationInterface * @covers Opf_Class::getTranslationInterface */ public function testSettingTranslationInterface() { Opl_Registry::register('opt', $this->_optMock); $opf = new Opf_Class(); $this->assertEquals(null, $opf->getTranslationInterface()); $opf->setTranslationInterface($mock = $this->getMock('Opl_Translation_Interface')); $this->assertSame($mock, $opf->getTranslationInterface()); $opf->setTranslationInterface(null); $this->assertEquals(null, $opf->getTranslationInterface()); }
function modifyVariable($item, $value) { $data = Opl_Registry::get('data'); $data[$item] = $value; Opl_Registry::register('data', $data); }
/** * Finalizes everything. */ protected function tearDown() { Opl_Registry::register('opt', null); Opt_View::clear(); unset($this->tpl); }
/** * @covers Opc_View_Cache::__construct */ public function testConstructException() { Opl_Registry::register('opc', null); $this->setExpectedException('Opc_ClassInstanceNotExists_Exception'); $viewCache = new Opc_View_Cache(array('key' => 'bar', 'cacheDir' => './cache', 'expiryTime' => 100)); }
/** * The class constructor - registers the main object in the * OPL registry. */ public function __construct() { Opl_Registry::register('opt', $this); }
/** * Free the existing Opt_Class object. */ protected function tearDown() { Opl_Registry::register('opt', null); unset($this->_tpl); }