mirror of
https://github.com/flarum/core.git
synced 2025-07-25 18:51:40 +02:00
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:
@@ -95,6 +95,8 @@ class Settings implements ExtenderInterface
|
|||||||
|
|
||||||
$defaults->put($key, $value);
|
$defaults->put($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $defaults;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -173,14 +173,16 @@ class SettingsTest extends TestCase
|
|||||||
(new Extend\Settings())
|
(new Extend\Settings())
|
||||||
->serializeToForum('customPrefix.unavailableCustomSetting3', 'custom-prefix.unavailable_custom_setting3')
|
->serializeToForum('customPrefix.unavailableCustomSetting3', 'custom-prefix.unavailable_custom_setting3')
|
||||||
->default('custom-prefix.unavailable_custom_setting3', 'extenderDefault')
|
->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()
|
$settings = $this->app()->getContainer()->make('flarum.settings');
|
||||||
->getContainer()
|
|
||||||
->make('flarum.settings')
|
|
||||||
->get('custom-prefix.unavailable_custom_setting3', 'defaultParameterValue');
|
|
||||||
|
|
||||||
$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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user