2025-08-16 14:52:29 +02:00
|
|
|
<?php
|
|
|
|
|
2025-08-16 19:36:45 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2025-08-16 14:52:29 +02:00
|
|
|
namespace Tests\integration\Api\Chart;
|
|
|
|
|
|
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
use Tests\integration\TestCase;
|
|
|
|
|
2025-08-16 19:36:45 +02:00
|
|
|
/**
|
|
|
|
* @internal
|
|
|
|
*
|
|
|
|
* @coversNothing
|
|
|
|
*/
|
|
|
|
final class BudgetControllerTest extends TestCase
|
2025-08-16 14:52:29 +02:00
|
|
|
{
|
|
|
|
use RefreshDatabase;
|
|
|
|
private $user;
|
|
|
|
|
|
|
|
#[Override]
|
|
|
|
protected function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
if (!isset($this->user)) {
|
|
|
|
$this->user = $this->createAuthenticatedUser();
|
|
|
|
}
|
|
|
|
$this->actingAs($this->user);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testGetOverviewChartFails(): void
|
|
|
|
{
|
|
|
|
$this->actingAs($this->user);
|
|
|
|
$response = $this->getJson(route('api.v1.chart.budget.overview'));
|
|
|
|
$response->assertStatus(422);
|
|
|
|
|
|
|
|
}
|
2025-08-16 19:36:45 +02:00
|
|
|
|
2025-08-16 14:52:29 +02:00
|
|
|
public function testGetOverviewChart(): void
|
|
|
|
{
|
|
|
|
$this->actingAs($this->user);
|
2025-08-16 19:36:45 +02:00
|
|
|
$params = [
|
2025-08-16 14:52:29 +02:00
|
|
|
'start' => '2024-01-01',
|
|
|
|
'end' => '2024-01-31',
|
|
|
|
];
|
2025-08-16 19:36:45 +02:00
|
|
|
$response = $this->getJson(route('api.v1.chart.budget.overview').'?'.http_build_query($params));
|
2025-08-16 14:52:29 +02:00
|
|
|
$response->assertStatus(200);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|