function testRender_object() { $object = new lmbObject(); $object->set('foo', 42); $this->view->set('object', $object); $this->_checkValue('{"object":{"foo":42}}'); }
function _setARField($property, $value) { $old_value = $this->_getRaw($property); parent::set($property, $value); // if property is a table field and was not really changed, don't mark it dirty if (!($this->_db_meta_info->hasColumn($property) && $old_value === $value)) { $this->_markDirtyProperty($property); } }
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'])); }
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; }
/** * Sets variable into toolkit * Checks if appropriate setter method in tools exists to delegate to * @return void */ function set($var, $value) { if ($method = $this->_mapPropertyToSetMethod($var)) { return $this->{$method}($value); } else { return parent::set($var, $value); } }
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')); } }