Files
Pham-Tan-Thien da1bd48444 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
2026-09-17 14:25:02 +07:00

43 lines
995 B
PHP

<?php
declare(strict_types=1);
namespace Tests\Unit\{{Namespace}};
use PHPUnit\Framework\TestCase;
use PHPUnit\Framework\Attributes\Test;
use Mockery;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
use {{TargetClassFullName}};
class {{ClassName}}Test extends TestCase
{
private {{ClassName}} $controller;
protected function setUp(): void
{
parent::setUp();
$this->controller = new {{ClassName}}();
}
protected function tearDown(): void
{
Mockery::close();
parent::tearDown();
}
#[Test]
public function it_returns_successful_response(): void
{
// 1. Arrange: Chuẩn bị HTTP Request
$request = Request::create('/api/resource', 'GET');
// 2. Act
$response = $this->controller->index($request);
// 3. Assert: Kiểm tra HTTP status và định dạng phản hồi
$this->assertSame(Response::HTTP_OK, $response->getStatusCode());
}
}