feat: decouple Laravel and CakePHP installers, remove SonarQube artifacts, and enforce complete unit testing standards
- Decouple framework installation: add install-laravel.sh and install-cakephp.sh, isolate skills and docs per framework, and auto-clean leftover artifacts - Remove all SonarQube configs, templates, and references - Enforce comprehensive test completeness: 100% public methods, edge cases, full branch coverage, exception paths, and state assertions - Replace all placeholder assertions in PHPUnit and Pest templates with full realistic implementations - Rename and update 10-comprehensive-test-coverage-guide.md
This commit is contained in:
@@ -5,21 +5,48 @@ declare(strict_types=1);
|
||||
use {{TargetClassFullName}};
|
||||
|
||||
beforeEach(function () {
|
||||
// $this->dependencyMock = Mockery::mock(DependencyInterface::class);
|
||||
// $this->service = new {{ClassName}}($this->dependencyMock);
|
||||
$this->dependencyMock = Mockery::mock('DependencyInterface');
|
||||
$this->service = new {{ClassName}}($this->dependencyMock);
|
||||
});
|
||||
|
||||
describe('{{ClassName}}', function () {
|
||||
it('executes successfully under normal conditions', function () {
|
||||
it('executes successfully with valid input', function () {
|
||||
// Arrange
|
||||
$input = 'sample_input';
|
||||
$expectedResult = 'success_result';
|
||||
|
||||
$this->dependencyMock
|
||||
->shouldReceive('execute')
|
||||
->once()
|
||||
->with($input)
|
||||
->andReturn($expectedResult);
|
||||
|
||||
// Act
|
||||
$result = $this->service->process($input);
|
||||
|
||||
// Assert
|
||||
expect(true)->toBeTrue();
|
||||
expect($result)->toBe($expectedResult);
|
||||
});
|
||||
|
||||
it('throws exception when input is invalid', function () {
|
||||
// expect(fn () => $this->service->method(...))->toThrow(\InvalidArgumentException::class);
|
||||
it('handles edge case input properly', function () {
|
||||
// Arrange
|
||||
$this->dependencyMock
|
||||
->shouldReceive('execute')
|
||||
->once()
|
||||
->with('')
|
||||
->andReturn('default_output');
|
||||
|
||||
// Act & Assert
|
||||
expect($this->service->process(''))->toBe('default_output');
|
||||
});
|
||||
|
||||
it('throws exception when dependency throws error', function () {
|
||||
$this->dependencyMock
|
||||
->shouldReceive('execute')
|
||||
->once()
|
||||
->andThrow(new \RuntimeException('Execution failed'));
|
||||
|
||||
expect(fn () => $this->service->process('error_trigger'))
|
||||
->toThrow(\RuntimeException::class, 'Execution failed');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user