mirror of
https://github.com/flarum/framework.git
synced 2025-03-22 13:05:15 +08:00
feat(test): Make it possible to extend SetupScript (#3643)
* Make it possible to extend Flarum\Testing\integration\Setup\SetupScript and added public methods to add settings or extensions to in initial installation pipeline * Fix syntax error, unexpected 'static' * Remove `addExtensions` method and document `addSettings`
This commit is contained in:
parent
267f6759f8
commit
7ce9d63ed6
@ -66,7 +66,13 @@ class SetupScript
|
||||
/**
|
||||
* @var DatabaseConfig
|
||||
*/
|
||||
private $dbConfig;
|
||||
protected $dbConfig;
|
||||
|
||||
/**
|
||||
* Settings to be applied during installation.
|
||||
* @var array
|
||||
*/
|
||||
protected $settings = ['mail_driver' => 'log'];
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@ -124,7 +130,7 @@ class SetupScript
|
||||
'password',
|
||||
'admin@machine.local'
|
||||
))
|
||||
->settings(['mail_driver' => 'log'])
|
||||
->settings($this->settings)
|
||||
->extensions([])
|
||||
->build();
|
||||
|
||||
@ -145,4 +151,20 @@ class SetupScript
|
||||
$builder->dropAllViews();
|
||||
}))->run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Can be used to add settings to the Flarum installation.
|
||||
* Use this only when it is really needed.
|
||||
* This can be useful in rare cases where the settings are required to be set
|
||||
* already when extensions Extenders are executed. In those cases, setting the
|
||||
* settings with the `setting()` method of the `TestCase` will not work.
|
||||
*
|
||||
* @param string $settings (key => value)
|
||||
*/
|
||||
public function addSettings(array $settings): self
|
||||
{
|
||||
$this->settings = array_merge($this->settings, $settings);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user