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:
@@ -101,4 +101,55 @@ class {{CONTROLLER_NAME}}ControllerTest extends TestCase
|
||||
// Assert
|
||||
$this->assertResponseOk(); // Renders form view with errors
|
||||
}
|
||||
|
||||
/**
|
||||
* Test view method with non-existent ID (404 Not Found)
|
||||
*/
|
||||
public function testViewNotFound(): void
|
||||
{
|
||||
// Act
|
||||
$this->get('/{{ROUTE_PATH}}/view/99999');
|
||||
|
||||
// Assert
|
||||
$this->assertResponseError();
|
||||
$this->assertResponseCode(404);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test edit method POST with valid data
|
||||
*/
|
||||
public function testEditSuccess(): void
|
||||
{
|
||||
// Arrange
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
|
||||
$data = [
|
||||
'name' => 'Updated Item',
|
||||
];
|
||||
|
||||
// Act
|
||||
$this->post('/{{ROUTE_PATH}}/edit/1', $data);
|
||||
|
||||
// Assert
|
||||
$this->assertResponseSuccess();
|
||||
$this->assertRedirect(['action' => 'index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test delete method POST/DELETE
|
||||
*/
|
||||
public function testDeleteSuccess(): void
|
||||
{
|
||||
// Arrange
|
||||
$this->enableCsrfToken();
|
||||
$this->enableSecurityToken();
|
||||
|
||||
// Act
|
||||
$this->delete('/{{ROUTE_PATH}}/delete/1');
|
||||
|
||||
// Assert
|
||||
$this->assertResponseSuccess();
|
||||
$this->assertRedirect(['action' => 'index']);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user