fix: settings extender working only with first instances (#3439)

* test: settings extender works not only with first extender instance
* fix: settings extender working only with first instances
This commit is contained in:
Sami Mazouz 2022-05-24 17:55:05 +01:00 committed by GitHub
parent 584884a3c9
commit eb4bac3b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -95,6 +95,8 @@ class Settings implements ExtenderInterface
$defaults->put($key, $value);
}
return $defaults;
});
}

View File

@ -173,14 +173,16 @@ class SettingsTest extends TestCase
(new Extend\Settings())
->serializeToForum('customPrefix.unavailableCustomSetting3', 'custom-prefix.unavailable_custom_setting3')
->default('custom-prefix.unavailable_custom_setting3', 'extenderDefault')
->default('custom-prefix.unavailable_custom_setting100', 'extenderDefault100'),
(new Extend\Settings())
->default('custom-prefix.unavailable_custom_setting200', 'extenderDefault200')
);
$value = $this->app()
->getContainer()
->make('flarum.settings')
->get('custom-prefix.unavailable_custom_setting3', 'defaultParameterValue');
$settings = $this->app()->getContainer()->make('flarum.settings');
$this->assertEquals('extenderDefault', $value);
$this->assertEquals('extenderDefault', $settings->get('custom-prefix.unavailable_custom_setting3'));
$this->assertEquals('extenderDefault100', $settings->get('custom-prefix.unavailable_custom_setting100'));
$this->assertEquals('extenderDefault200', $settings->get('custom-prefix.unavailable_custom_setting200'));
}
/**