/** * Append value to a path in registry * * @param string $path Parent registry Path (e.g. joomla.content.showauthor) * @param mixed $value Value of entry * * @return mixed The value of the that has been set. * * @since 1.4.0 */ public function append($path, $value) { $this->registry->push($path, $value); return $value; }
/** * testAppend * * @return void * * @covers Windwalker\Registry\Registry::push */ public function testPush() { $registry = new Registry(); $registry->set('foo', array('var1', 'var2', 'var3')); $registry->push('foo', 'var4'); $this->assertEquals('var4', $registry->get('foo.3')); $registry->push('foo', 'var5', 'var6'); $this->assertEquals('var5', $registry->get('foo.4')); $this->assertEquals('var6', $registry->get('foo.5')); $registry->setRaw('foo2', (object) array('var1', 'var2', 'var3')); $b = $registry->get('foo2'); $this->assertTrue(is_object($b)); $registry->push('foo2', 'var4'); $b = $registry->get('foo2'); $this->assertTrue(is_array($b)); }