mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-17 04:32:15 +01:00
fix shared report endpoint test to check new structure that includes organization format properties, format
This commit is contained in:
@@ -15,6 +15,7 @@ class CurrencyController extends Controller
|
|||||||
* Get all currencies
|
* Get all currencies
|
||||||
*
|
*
|
||||||
* @response array{code: string, name: string, symbol: string}[]
|
* @response array{code: string, name: string, symbol: string}[]
|
||||||
|
*
|
||||||
* @operationId getCurrencies
|
* @operationId getCurrencies
|
||||||
*/
|
*/
|
||||||
public function index(): JsonResponse
|
public function index(): JsonResponse
|
||||||
@@ -26,7 +27,7 @@ class CurrencyController extends Controller
|
|||||||
'code' => $currency->getCurrencyCode(),
|
'code' => $currency->getCurrencyCode(),
|
||||||
'name' => $currency->getName(),
|
'name' => $currency->getName(),
|
||||||
'symbol' => $currencyService->getCurrencySymbol($currency->getCurrencyCode()),
|
'symbol' => $currencyService->getCurrencySymbol($currency->getCurrencyCode()),
|
||||||
],
|
],
|
||||||
ISOCurrencyProvider::getInstance()->getAvailableCurrencies()
|
ISOCurrencyProvider::getInstance()->getAvailableCurrencies()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|||||||
@@ -40,9 +40,9 @@ class OrganizationResource extends BaseResource
|
|||||||
*/
|
*/
|
||||||
public function toArray(Request $request): array
|
public function toArray(Request $request): array
|
||||||
{
|
{
|
||||||
$currencyService = app(CurrencyService::class);
|
$currencyService = app(CurrencyService::class);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
/** @var string $id ID */
|
/** @var string $id ID */
|
||||||
'id' => $this->resource->id,
|
'id' => $this->resource->id,
|
||||||
/** @var string $name Name */
|
/** @var string $name Name */
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use App\Models\Report;
|
|||||||
use App\Models\Tag;
|
use App\Models\Tag;
|
||||||
use App\Models\Task;
|
use App\Models\Task;
|
||||||
use App\Models\TimeEntry;
|
use App\Models\TimeEntry;
|
||||||
|
use App\Service\CurrencyService;
|
||||||
use App\Service\Dto\ReportPropertiesDto;
|
use App\Service\Dto\ReportPropertiesDto;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Tests\Unit\Endpoint\Api\V1\ApiEndpointTestAbstract;
|
use Tests\Unit\Endpoint\Api\V1\ApiEndpointTestAbstract;
|
||||||
@@ -104,6 +105,8 @@ class PublicReportEndpointTest extends ApiEndpointTestAbstract
|
|||||||
TimeEntry::factory()->forOrganization($organization)->forTask($task2)->startWithDuration(now()->subDay(), 100)->create();
|
TimeEntry::factory()->forOrganization($organization)->forTask($task2)->startWithDuration(now()->subDay(), 100)->create();
|
||||||
TimeEntry::factory()->forOrganization($organization)->startWithDuration(now()->subDay(), 100)->create();
|
TimeEntry::factory()->forOrganization($organization)->startWithDuration(now()->subDay(), 100)->create();
|
||||||
|
|
||||||
|
$currencyService = app(CurrencyService::class);
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
$response = $this->getJson(route('api.v1.public.reports.show'), [
|
$response = $this->getJson(route('api.v1.public.reports.show'), [
|
||||||
'X-Api-Key' => $report->share_secret,
|
'X-Api-Key' => $report->share_secret,
|
||||||
@@ -116,6 +119,12 @@ class PublicReportEndpointTest extends ApiEndpointTestAbstract
|
|||||||
'description' => $report->description,
|
'description' => $report->description,
|
||||||
'public_until' => $report->public_until?->toIso8601ZuluString(),
|
'public_until' => $report->public_until?->toIso8601ZuluString(),
|
||||||
'currency' => $organization->currency,
|
'currency' => $organization->currency,
|
||||||
|
'number_format' => $organization->number_format,
|
||||||
|
'interval_format' => $organization->interval_format,
|
||||||
|
'currency_format' => $organization->currency_format,
|
||||||
|
'currency_symbol' => $currencyService->getCurrencySymbol($organization->currency),
|
||||||
|
'time_format' => $organization->time_format,
|
||||||
|
'date_format' => $organization->date_format,
|
||||||
'properties' => [
|
'properties' => [
|
||||||
'group' => $reportDto->group->value,
|
'group' => $reportDto->group->value,
|
||||||
'sub_group' => $reportDto->subGroup->value,
|
'sub_group' => $reportDto->subGroup->value,
|
||||||
|
|||||||
Reference in New Issue
Block a user