public function testAddSettingAndSettingFactory() { $this->res->addSetting(array('fruit' => array('mine' => 'apple'))); $muckableValue = array('fruit' => array('yours' => 'orange', 'theirs' => 'apricot')); $this->res->addSettingsFactory(function () use(&$muckableValue) { return $muckableValue; }); $actual = $this->res->getSettings(); $expected = array('fruit' => array('mine' => 'apple', 'yours' => 'orange', 'theirs' => 'apricot')); $this->assertTreeEquals($expected, $actual); // note: the setting is not fixed based on what the factory returns when registered; it's based // on what the factory returns when getSettings is called $muckableValue = array('fruit' => array('yours' => 'banana')); $actual = $this->res->getSettings(); $expected = array('fruit' => array('mine' => 'apple', 'yours' => 'banana')); $this->assertTreeEquals($expected, $actual); }