You've already forked Php-Template
Some checks are pending
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Waiting to run
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m39s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m44s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m41s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 2m55s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m59s
Reviewed-on: #24 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
41 lines
1013 B
PHP
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());
|
|
}
|
|
}
|