You've already forked Php-Template
Some checks failed
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 3m5s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Failing after 2m56s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 3m12s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m32s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m17s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 1m42s
41 lines
977 B
PHP
41 lines
977 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"}', (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"}', (string)$response->getBody());
|
|
}
|
|
}
|