strategy change to TDD

This commit is contained in:
2026-02-17 10:42:32 -05:00
parent 04022b7e0b
commit 54df6018f5
13 changed files with 2620 additions and 334 deletions

View File

@@ -0,0 +1,92 @@
<?php
use App\Services\{{service}};
uses()->group('{{capability}}', 'unit');
/*
* Test Template for Pest Unit Tests
*
* Copy this file and replace:
* - {{capability}} with the capability name
* - {{service}} with the class being tested
*
* Mark pending tests with ->todo() during Red Phase
* Remove ->todo() and implement during Green Phase
*/
describe('{{service}}', function () {
beforeEach(function () {
$this->service = new {{service}}();
});
/*
* Test: {{method_description}}
*
* Tests the core logic of {{method_name}}
*/
it('{{method_description}}', function () {
// Arrange
$input = [
// Test input data
];
$expected = [
// Expected output
];
// Act
$result = $this->service->{{method_name}}($input);
// Assert
expect($result)->toBe($expected);
})->todo();
/*
* Test: Edge case handling
*/
it('handles {{edge_case}} gracefully', function () {
// Arrange
$edgeCaseInput = null;
// Act & Assert
expect(fn () => $this->service->{{method_name}}($edgeCaseInput))
->toThrow(\InvalidArgumentException::class);
})->todo();
/*
* Test: Calculation accuracy
*/
it('calculates {{calculation}} correctly', function () {
// Arrange
$a = 10;
$b = 20;
// Act
$result = $this->service->calculate($a, $b);
// Assert
expect($result)->toBe(30);
})->todo();
});
/*
* Data providers for parameterized tests
*/
dataset('valid_inputs', function () {
return [
'case 1' => [['input' => 'value1'], 'expected1'],
'case 2' => [['input' => 'value2'], 'expected2'],
'case 3' => [['input' => 'value3'], 'expected3'],
];
});
/*
* Example parameterized test
*/
it('processes valid inputs correctly', function ($input, $expected) {
$result = $this->service->process($input);
expect($result)->toBe($expected);
})->with('valid_inputs')->todo();