Files
Php-Template/tests/Controllers/IndexControllerTest.php
Ron Rise af2f164546
All checks were successful
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m51s
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m56s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m50s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m52s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m1s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m21s
feat: implement GenericResponse class and update controllers to use it for consistent JSON responses
2025-12-01 11:16:59 -05:00

41 lines
1013 B
PHP

<?php
declare(strict_types=1);
namespace Siteworxpro\Tests\Controllers;
use Siteworxpro\App\Controllers\IndexController;
class IndexControllerTest extends AbstractController
{
/**
* @throws \JsonException
*/
public function testGet(): void
{
$this->assertTrue(true);
$controller = new IndexController();
$response = $controller->get($this->getMockRequest());
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('{"message":"Server is running","status_code":200}', (string)$response->getBody());
}
/**
* @throws \JsonException
*/
public function testPost(): void
{
$this->assertTrue(true);
$controller = new IndexController();
$response = $controller->post($this->getMockRequest());
$this->assertEquals(200, $response->getStatusCode());
$this->assertEquals('{"message":"POST request received","status_code":200}', (string)$response->getBody());
}
}