Fix daily_summary dan hourly_summary aggregation, tambah fallback logic untuk dashboard, update validator untuk camera dan location type
This commit is contained in:
47
bin/test_api_response.php
Normal file
47
bin/test_api_response.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use App\Config\AppConfig;
|
||||
use App\Support\Database;
|
||||
use App\Modules\Retribusi\Dashboard\DashboardService;
|
||||
use App\Modules\Retribusi\Dashboard\DashboardController;
|
||||
|
||||
AppConfig::loadEnv(__DIR__ . '/..');
|
||||
|
||||
$db = Database::getConnection(
|
||||
AppConfig::get('DB_HOST'),
|
||||
AppConfig::get('DB_NAME'),
|
||||
AppConfig::get('DB_USER'),
|
||||
AppConfig::get('DB_PASS')
|
||||
);
|
||||
|
||||
$service = new DashboardService($db);
|
||||
$controller = new DashboardController($service);
|
||||
|
||||
// Simulate request
|
||||
$request = new \Slim\Psr7\Factory\ServerRequestFactory();
|
||||
$response = new \Slim\Psr7\Factory\ResponseFactory();
|
||||
|
||||
// Test summary endpoint
|
||||
echo "=== Test Dashboard Summary API Response ===\n\n";
|
||||
|
||||
// Test dengan tanggal yang ada data
|
||||
$request = $request->createServerRequest('GET', '/retribusi/v1/dashboard/summary')
|
||||
->withQueryParams(['date' => '2025-12-16']);
|
||||
|
||||
$response = $controller->getSummary($request, $response->createResponse());
|
||||
|
||||
echo "Status: " . $response->getStatusCode() . "\n";
|
||||
echo "Body:\n";
|
||||
echo $response->getBody() . "\n\n";
|
||||
|
||||
// Test by category
|
||||
$request = $request->withQueryParams(['date' => '2025-12-16']);
|
||||
$response = $controller->getByCategoryChart($request, $response->createResponse());
|
||||
|
||||
echo "=== Test By Category API Response ===\n";
|
||||
echo "Status: " . $response->getStatusCode() . "\n";
|
||||
echo "Body:\n";
|
||||
echo $response->getBody() . "\n";
|
||||
|
||||
Reference in New Issue
Block a user