mirror of
https://github.com/flarum/framework.git
synced 2025-03-23 05:35: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
|
* @var DatabaseConfig
|
||||||
*/
|
*/
|
||||||
private $dbConfig;
|
protected $dbConfig;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Settings to be applied during installation.
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $settings = ['mail_driver' => 'log'];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
@ -124,7 +130,7 @@ class SetupScript
|
|||||||
'password',
|
'password',
|
||||||
'admin@machine.local'
|
'admin@machine.local'
|
||||||
))
|
))
|
||||||
->settings(['mail_driver' => 'log'])
|
->settings($this->settings)
|
||||||
->extensions([])
|
->extensions([])
|
||||||
->build();
|
->build();
|
||||||
|
|
||||||
@ -145,4 +151,20 @@ class SetupScript
|
|||||||
$builder->dropAllViews();
|
$builder->dropAllViews();
|
||||||
}))->run();
|
}))->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