Skip to content

Commit 4e43a7e

Browse files
committed
Laravel/boost upgrade to v2. Remove WARP.md
1 parent 2b80b71 commit 4e43a7e

12 files changed

Lines changed: 1269 additions & 820 deletions

File tree

WARP.md

Lines changed: 0 additions & 72 deletions
This file was deleted.
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
name: pest-testing
3+
description: "Tests applications using the Pest 3 PHP framework. Activates when writing tests, creating unit or feature tests, adding assertions, testing Livewire components, architecture testing, debugging test failures, working with datasets or mocking; or when the user mentions test, spec, TDD, expects, assertion, coverage, or needs to verify functionality works."
4+
license: MIT
5+
metadata:
6+
author: laravel
7+
---
8+
9+
# Pest Testing 3
10+
11+
## When to Apply
12+
13+
Activate this skill when:
14+
- Creating new tests (unit or feature)
15+
- Modifying existing tests
16+
- Debugging test failures
17+
- Working with datasets, mocking, or test organization
18+
- Writing architecture tests
19+
20+
## Documentation
21+
22+
Use `search-docs` for detailed Pest 3 patterns and documentation.
23+
24+
## Basic Usage
25+
26+
### Creating Tests
27+
28+
All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
29+
30+
### Test Organization
31+
32+
- Tests live in the `tests/Feature` and `tests/Unit` directories.
33+
- Do NOT remove tests without approval - these are core application code.
34+
- Test happy paths, failure paths, and edge cases.
35+
36+
### Basic Test Structure
37+
38+
<!-- Basic Pest Test Example -->
39+
```php
40+
it('is true', function () {
41+
expect(true)->toBeTrue();
42+
});
43+
```
44+
45+
### Running Tests
46+
47+
- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`.
48+
- Run all tests: `php artisan test --compact`.
49+
- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`.
50+
51+
## Assertions
52+
53+
Use specific assertions (`assertSuccessful()`, `assertNotFound()`) instead of `assertStatus()`:
54+
55+
<!-- Pest Response Assertion -->
56+
```php
57+
it('returns all', function () {
58+
$this->postJson('/api/docs', [])->assertSuccessful();
59+
});
60+
```
61+
62+
| Use | Instead of |
63+
|-----|------------|
64+
| `assertSuccessful()` | `assertStatus(200)` |
65+
| `assertNotFound()` | `assertStatus(404)` |
66+
| `assertForbidden()` | `assertStatus(403)` |
67+
68+
## Mocking
69+
70+
Import mock function before use: `use function Pest\Laravel\mock;`
71+
72+
## Datasets
73+
74+
Use datasets for repetitive tests (validation rules, etc.):
75+
76+
<!-- Pest Dataset Example -->
77+
```php
78+
it('has emails', function (string $email) {
79+
expect($email)->not->toBeEmpty();
80+
})->with([
81+
'james' => 'james@laravel.com',
82+
'taylor' => 'taylor@laravel.com',
83+
]);
84+
```
85+
86+
## Pest 3 Features
87+
88+
### Architecture Testing
89+
90+
Pest 3 includes architecture testing to enforce code conventions:
91+
92+
<!-- Architecture Test Example -->
93+
```php
94+
arch('controllers')
95+
->expect('App\Http\Controllers')
96+
->toExtendNothing()
97+
->toHaveSuffix('Controller');
98+
99+
arch('models')
100+
->expect('App\Models')
101+
->toExtend('Illuminate\Database\Eloquent\Model');
102+
103+
arch('no debugging')
104+
->expect(['dd', 'dump', 'ray'])
105+
->not->toBeUsed();
106+
```
107+
108+
### Type Coverage
109+
110+
Pest 3 provides improved type coverage analysis. Run with `--type-coverage` flag.
111+
112+
## Common Pitfalls
113+
114+
- Not importing `use function Pest\Laravel\mock;` before using mock
115+
- Using `assertStatus(200)` instead of `assertSuccessful()`
116+
- Forgetting datasets for repetitive validation tests
117+
- Deleting tests without approval
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
name: pest-testing
3+
description: "Tests applications using the Pest 3 PHP framework. Activates when writing tests, creating unit or feature tests, adding assertions, testing Livewire components, architecture testing, debugging test failures, working with datasets or mocking; or when the user mentions test, spec, TDD, expects, assertion, coverage, or needs to verify functionality works."
4+
license: MIT
5+
metadata:
6+
author: laravel
7+
---
8+
9+
# Pest Testing 3
10+
11+
## When to Apply
12+
13+
Activate this skill when:
14+
- Creating new tests (unit or feature)
15+
- Modifying existing tests
16+
- Debugging test failures
17+
- Working with datasets, mocking, or test organization
18+
- Writing architecture tests
19+
20+
## Documentation
21+
22+
Use `search-docs` for detailed Pest 3 patterns and documentation.
23+
24+
## Basic Usage
25+
26+
### Creating Tests
27+
28+
All tests must be written using Pest. Use `php artisan make:test --pest {name}`.
29+
30+
### Test Organization
31+
32+
- Tests live in the `tests/Feature` and `tests/Unit` directories.
33+
- Do NOT remove tests without approval - these are core application code.
34+
- Test happy paths, failure paths, and edge cases.
35+
36+
### Basic Test Structure
37+
38+
<!-- Basic Pest Test Example -->
39+
```php
40+
it('is true', function () {
41+
expect(true)->toBeTrue();
42+
});
43+
```
44+
45+
### Running Tests
46+
47+
- Run minimal tests with filter before finalizing: `php artisan test --compact --filter=testName`.
48+
- Run all tests: `php artisan test --compact`.
49+
- Run file: `php artisan test --compact tests/Feature/ExampleTest.php`.
50+
51+
## Assertions
52+
53+
Use specific assertions (`assertSuccessful()`, `assertNotFound()`) instead of `assertStatus()`:
54+
55+
<!-- Pest Response Assertion -->
56+
```php
57+
it('returns all', function () {
58+
$this->postJson('/api/docs', [])->assertSuccessful();
59+
});
60+
```
61+
62+
| Use | Instead of |
63+
|-----|------------|
64+
| `assertSuccessful()` | `assertStatus(200)` |
65+
| `assertNotFound()` | `assertStatus(404)` |
66+
| `assertForbidden()` | `assertStatus(403)` |
67+
68+
## Mocking
69+
70+
Import mock function before use: `use function Pest\Laravel\mock;`
71+
72+
## Datasets
73+
74+
Use datasets for repetitive tests (validation rules, etc.):
75+
76+
<!-- Pest Dataset Example -->
77+
```php
78+
it('has emails', function (string $email) {
79+
expect($email)->not->toBeEmpty();
80+
})->with([
81+
'james' => 'james@laravel.com',
82+
'taylor' => 'taylor@laravel.com',
83+
]);
84+
```
85+
86+
## Pest 3 Features
87+
88+
### Architecture Testing
89+
90+
Pest 3 includes architecture testing to enforce code conventions:
91+
92+
<!-- Architecture Test Example -->
93+
```php
94+
arch('controllers')
95+
->expect('App\Http\Controllers')
96+
->toExtendNothing()
97+
->toHaveSuffix('Controller');
98+
99+
arch('models')
100+
->expect('App\Models')
101+
->toExtend('Illuminate\Database\Eloquent\Model');
102+
103+
arch('no debugging')
104+
->expect(['dd', 'dump', 'ray'])
105+
->not->toBeUsed();
106+
```
107+
108+
### Type Coverage
109+
110+
Pest 3 provides improved type coverage analysis. Run with `--type-coverage` flag.
111+
112+
## Common Pitfalls
113+
114+
- Not importing `use function Pest\Laravel\mock;` before using mock
115+
- Using `assertStatus(200)` instead of `assertSuccessful()`
116+
- Forgetting datasets for repetitive validation tests
117+
- Deleting tests without approval

_api_app/.codex/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[mcp_servers.laravel-boost]
2+
command = "php"
3+
args = ["artisan", "boost:mcp"]
4+
cwd = "/Users/uldis/projects/berta/berta/_api_app"

0 commit comments

Comments
 (0)