Skip to content

Commit 9d2c084

Browse files
committed
wip
1 parent bd12bb8 commit 9d2c084

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

docs/1-essentials/07-testing.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ composer phpunit
2222

2323
## Test-specific discovery locations
2424

25-
Tempest will only discover non-dev namespaces defined in composer.json automatically. That means that `{:hl-keyword:require-dev:}` namespaces aren't discovered automatically. Whenever you need Tempest to discover test-specific locations, you may specify them within the `discoverTestLocations()` method of the provided `IntegrationTestCase` class.
25+
Tempest will only discover non-dev namespaces defined in composer.json automatically. That means that `{:hl-keyword:require-dev:}` namespaces aren't discovered automatically. Whenever you need Tempest to discover test-specific locations, you may specify them within the `discoverTestLocations()` method of the provided `IntegrationTest` class.
2626

2727
On top of that, Tempest _will_ look for files in the `tests/Fixtures` directory and discover them by default. You can override this behavior by providing your own implementation of `discoverTestLocations()`, where you can return an array of `DiscoveryLocation` objects (or nothing).
2828

@@ -46,7 +46,7 @@ final class HomeControllerTest extends IntegrationTest
4646
If you want to test code that interacts with the database, your test class can call the `setupDatabase()` method. This method will create and migrate a clean database for you on the fly.
4747

4848
```php
49-
class TodoControllerTest extends IntegrationTestCase
49+
class TodoControllerTest extends IntegrationTest
5050
{
5151
protected function setUp(): void
5252
{
@@ -72,7 +72,7 @@ return new SQLiteConfig(
7272
By default, no tables will be migrated. You can choose to provide a list of migrations that will be run for every test that calls `setupDatabase()`, or you can run specific migrations on a per-test basis.
7373

7474
```php
75-
class TodoControllerTest extends IntegrationTestCase
75+
class TodoControllerTest extends IntegrationTest
7676
{
7777
protected function migrateDatabase(): void
7878
{
@@ -85,7 +85,7 @@ class TodoControllerTest extends IntegrationTestCase
8585
```
8686

8787
```php
88-
class TodoControllerTest extends IntegrationTestCase
88+
class TodoControllerTest extends IntegrationTest
8989
{
9090
public function test_create_todo(): void
9191
{
@@ -101,7 +101,7 @@ class TodoControllerTest extends IntegrationTestCase
101101

102102
## Tester utilities
103103

104-
The `IntegrationTestCase` provides several utilities to make testing easier. You can read the details about each tester utility on the documentation page of its respective component. For example, there's the [http tester](../1-essentials/01-routing.md#testing) that helps you test HTTP requests:
104+
The `IntegrationTest` provides several utilities to make testing easier. You can read the details about each tester utility on the documentation page of its respective component. For example, there's the [http tester](../1-essentials/01-routing.md#testing) that helps you test HTTP requests:
105105

106106
```php
107107
$this->http
@@ -157,7 +157,7 @@ The next step is to create a `tests/Pest.php` file, which will instruct Pest how
157157

158158
```php tests/Pest.php
159159
pest()
160-
->extend(Tests\IntegrationTestCase::class)
160+
->extend(Tests\IntegrationTest::class)
161161
->in(__DIR__);
162162
```
163163

src/Tempest/Framework/Testing/IntegrationTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected function setupBaseRequest(): self
161161

162162
protected function setupDatabase(): self
163163
{
164-
$migrationManager = $this->get(MigrationManager::class);
164+
$migrationManager = $this->container->get(MigrationManager::class);
165165

166166
$migrationManager->dropAll();
167167

@@ -234,7 +234,6 @@ protected function assertException(
234234
return;
235235
}
236236

237-
/* @phpstan-ignore-next-line */
238237
$this->fail("Expected exception {$expectedExceptionClass} was not thrown");
239238
}
240239
}

0 commit comments

Comments
 (0)