You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Web/Documentation/content/1.x/1-essentials/07-testing.md
+25-1Lines changed: 25 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -38,13 +38,37 @@ final class HomeControllerTest extends IntegrationTestCase
38
38
}
39
39
```
40
40
41
+
## Test-specific discovery locations
42
+
43
+
Tempest does not discover files outside of the namespaces defined in the `require` object of `composer.json`. If you need Tempest to discover test-specific fixture files, you may specify paths using the `discoveryLocations` property of the provided `IntegrationTestCase` class.
44
+
45
+
For instance, you may create a `tests/config` directory that contains test-specific configuration files, and instruct Tempest to discover them:
46
+
47
+
```php tests/IntegrationTestCase.php
48
+
use Tempest\Core\DiscoveryLocation;
49
+
50
+
final class IntegrationTestCase extends TestCase
51
+
{
52
+
protected string $root = __DIR__ . '/../';
53
+
54
+
protected function setUp(): void
55
+
{
56
+
$this->discoveryLocations = [
57
+
new DiscoveryLocation(namespace: 'Tests\\Config', path: __DIR__ . '/config'),
58
+
];
59
+
60
+
parent::setUp();
61
+
}
62
+
}
63
+
```
64
+
41
65
## Changing the location of tests
42
66
43
67
The `phpunit.xml` file contains a `{html}<testsuite>` element that configures the directory in which PHPUnit looks for test files. This may be changed to follow any rule of your convenience.
44
68
45
69
For instance, you may colocate test files and their corresponding class by changing the `{html}suffix` attribute in `phpunit.xml` to the following:
0 commit comments