Lia.php
<?php
namespace Lia\Test\NewTest;
class Lia extends \Tlf\Tester {
public function testGetSetAppend(){
$lia = new \Lia();
$addon1 = new \stdClass;
$addon1->cat = 'bear';
$addon1->dog = 'vader';
$lia->fqn_addons['test:package.one'] = $addon1;
$lia->addons['one'] = $addon1;
$addon2 = new \stdClass;
$addon2->bear = 'reed';
$addon2->cat = 'jeff';
$addon2->kids = [];
$lia->fqn_addons['test:package.two'] = $addon2;
$lia->addons['two'] = $addon2;
$this->compare(
'bear',
$lia->get('test:package.one.cat')
);
$this->compare(
'vader',
$lia->get('one.dog')
);
$lia->set('test:package.one.cat', 'best bear');
$lia->set('test:package.one.dog', 'darth vader');
$this->compare(
'best bear',
$addon1->cat
);
$this->compare(
'darth vader',
$addon1->dog
);
$lia->set('two.bear', 'reedy');
$this->compare('reedy',$addon2->bear);
$this->compare('jeff',$addon2->cat);
$lia->append('test:package.two.kids', 'baby');
$lia->append('two.kids', 'adult');
$this->compare(['baby', 'adult'], $lia->get('two.kids'));
$lia->set('two.bear.cat', 'idk weird');
$prop = 'bear.cat';
$this->compare('idk weird', $addon2->$prop);
}
}