Exemplo n.º 1
0
 function testRender_object()
 {
     $object = new lmbObject();
     $object->set('foo', 42);
     $this->view->set('object', $object);
     $this->_checkValue('{"object":{"foo":42}}');
 }
Exemplo n.º 2
0
 function get($name, $default = LIMB_UNDEFINED)
 {
     if (!$name) {
         throw new lmbInvalidArgumentException('Option name not given');
     }
     try {
         return parent::get($name, $default);
     } catch (lmbNoSuchPropertyException $e) {
         throw new lmbNoSuchPropertyException('Option ' . $name . ' not found', array('config' => $this->_file));
     }
 }
Exemplo n.º 3
0
 /**
  *  Plain export of object data(lazy properties not included if not loaded)
  *  @see lmbObject::export()
  *  @return array
  */
 function exportRaw()
 {
     return parent::export();
 }
Exemplo n.º 4
0
 protected function _getConfig($dsn = null, $cache_name = 'test')
 {
     $config = new lmbObject();
     $config->set('cache_enabled', true);
     if ($dsn) {
         $config->set($cache_name . '_cache_dsn', $dsn);
     } else {
         $config->set($cache_name . '_cache_dsn', 'memory:');
     }
     return $config;
 }
Exemplo n.º 5
0
 function testImplementsArrayAccessInterface()
 {
     $o = new lmbObject();
     $o->set('foo', 'Bar');
     $this->assertEqual($o['foo'], 'Bar');
     $o['foo'] = 'Zoo';
     $this->assertEqual($o->get('foo'), 'Zoo');
     unset($o['foo']);
     $this->assertFalse($o->has('foo'));
     $o->set('foo', 'Bar');
     $this->assertTrue(isset($o['foo']));
     $this->assertFalse(isset($o['bar']));
 }
Exemplo n.º 6
0
 /**
  * Gets variable from toolkit directly
  * @return mixed
  */
 function getRaw($var)
 {
     return parent::_getRaw($var);
 }
 function testObjectClone()
 {
     $value = 'bar';
     $obj = new lmbObject();
     $obj->set('foo', $value);
     $this->cache->set($id = $this->_getUniqueId('testObjectClone'), $obj);
     $obj->set('foo', 'new value');
     $cached_obj = $this->cache->get($id);
     if ($this->assertIsA($cached_obj, 'lmbObject')) {
         $this->assertEqual($value, $cached_obj->get('foo'));
     }
 }
Exemplo n.º 8
0
 function __construct($message, $fields = array(), $values = array())
 {
     parent::__construct(array('message' => $message, 'fields' => $fields, 'values' => $values));
 }
Exemplo n.º 9
0
 protected function _getFilled($name)
 {
     $value = parent::_getRaw($name);
     return $this->_fillTemplate($value);
 }
Exemplo n.º 10
0
 function testGetClass()
 {
     $wrapped = new lmbObject();
     $proxy = new ProxyTestingStub($wrapped);
     $this->assertEqual($proxy->getClass(), $wrapped->getClass());
 }