Files
agent-unit-testing/templates/phpunit/JobTest.template.php
T
Pham-Tan-Thien 0dce2ef812 feat: enforce exhaustive unit testing and 100% SonarQube branch coverage
- Enforce mandatory handle() and failed() method testing for all Jobs and Commands
- Ban shallow reflection-only helper testing in Jobs
- Mandate actual SQLite in-memory query execution for Repositories (ban Builder::class assertions alone)
- Enforce full branch coverage for SonarQube (ternary, null-coalescing, catch blocks, match)
- Update JobTest templates for PHPUnit and Pest to include handle() and failed() methods
- Update verification checklist and master system prompt with strict branch gatekeepers

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-09-08 15:01:01 +07:00

50 lines
1.0 KiB
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\{{Namespace}};
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Test;
use Mockery;
use {{TargetClassFullName}};
class {{ClassName}}Test extends TestCase
{
protected function tearDown(): void
{
Mockery::close();
parent::tearDown();
}
#[Test]
public function it_handles_job_execution_successfully(): void
{
// Arrange
// $dependencyMock = Mockery::mock(Service::class);
// $dependencyMock->shouldReceive('execute')->once();
// $job = new {{ClassName}}(...);
// Act
// $job->handle($dependencyMock);
// Assert
$this->assertTrue(true);
}
#[Test]
public function it_handles_job_failure_cleanly(): void
{
// Arrange
// $job = new {{ClassName}}(...);
// $exception = new \RuntimeException('Job failed');
// Act
// $job->failed($exception);
// Assert
$this->assertTrue(true);
}
}