Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them
Scanned 6/6/2026
Install via CLI
openskills install jpcaparas/superpowers-laravel---
name: laravel:controller-tests
description: Write focused controller tests using HTTP assertions; keep heavy logic in Actions/Services and unit test them
---
# Controller Tests
## Feature tests for endpoints
```php
it('rejects empty email', function () {
$this->post('/register', ['email' => ''])->assertSessionHasErrors('email');
});
```
## Better tests
- Move validation to Form Requests; assert errors from the request class
- Extract business logic into Actions; unit test them directly
- Use factories for realistic data; avoid heavy mocking
No comments yet. Be the first to comment!
Go测试模式包括表格驱动测试、子测试、基准测试、模糊测试和测试覆盖率。遵循TDD方法论,采用地道的Go实践。