Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 /**
  * 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);
 }
Exemplo n.º 3
0
 /**
  * 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);
 }
Exemplo n.º 4
0
 /**
  * @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());
 }
Exemplo n.º 5
0
 /**
  * @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());
 }
Exemplo n.º 6
0
function modifyVariable($item, $value)
{
    $data = Opl_Registry::get('data');
    $data[$item] = $value;
    Opl_Registry::register('data', $data);
}
Exemplo n.º 7
0
 /**
  * Finalizes everything.
  */
 protected function tearDown()
 {
     Opl_Registry::register('opt', null);
     Opt_View::clear();
     unset($this->tpl);
 }
Exemplo n.º 8
0
 /**
  * @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));
 }
Exemplo n.º 9
0
 /**
  * The class constructor - registers the main object in the
  * OPL registry.
  */
 public function __construct()
 {
     Opl_Registry::register('opt', $this);
 }
Exemplo n.º 10
0
 /**
  * Free the existing Opt_Class object.
  */
 protected function tearDown()
 {
     Opl_Registry::register('opt', null);
     unset($this->_tpl);
 }