Skip to content

Commit 57c9f2d

Browse files
committed
Document setting method for integration tests
1 parent 8d64c3e commit 57c9f2d

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

docs/extend/testing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ Your testcase classes should extend this class.
146146

147147
There are several important utilities available for your test cases:
148148

149+
- The `setting()` method allows you to override settings before the app has booted. This is useful if your boot process has logic depending on settings (e.g. which driver to use for some system).
149150
- The `extension()` method will take Flarum IDs of extensions to enable as arguments. Your extension should always call this with your extension's ID at the start of test cases, unless the goal of the test case in question is to confirm some behavior present without your extension, and compare that to behavior when your extension is enabled. If your extension is dependent on other extensions, make sure they are included in the composer.json `require` field (or `require-dev` for [optional dependencies](dependencies.md)), and also list their composer package names when calling `extension()`. Note that you must list them in a valid order.
150151
- The `extend()` method takes instances of extenders as arguments, and is useful for testing extenders introduced by your extension for other extensions to use.
151152
- The `prepareDatabase()` method allow you to pre-populate your database. This could include adding users, discussions, posts, configuring permissions, etc. Its argument is an associative array that maps table names to arrays of [record arrays](https://laravel.com/docs/8.x/queries#insert-statements).
@@ -183,6 +184,8 @@ class SomeTest extends TestCase
183184
{
184185
parent::setUp();
185186

187+
$this->setting('my.custom.setting', true);
188+
186189
// Let's assume our extension depends on tags.
187190
// Note that tags will need to be in your extension's composer.json's `require-dev`.
188191
// Also, make sure you include the ID of the extension currently being tested, unless you're

0 commit comments

Comments
 (0)