Files
shipping-portal/tests/Feature/Segments/ControllersLogic/FetchConstantLogicTest.php
T
2026-04-06 11:26:16 +08:00

35 lines
1.1 KiB
PHP

<?php
/**
* Original controller logic file:
* app/Classes/Modules/Segments/ControllersLogic/FetchConstantLogic.php
*/
namespace Tests\Feature\Segments\ControllersLogic;
use App\Classes\ValueObjects\Constants\SegmentConstants;
use PHPUnit\Framework\Attributes\Group;
#[Group('feature')]
#[Group('segments')]
#[Group('controllers_logic')]
#[Group('ok_to_run')]
class FetchConstantLogicTest extends SegmentsControllerLogicTestCase
{
public function test_it_can_fetch_a_constant_via_controller_logic()
{
// A R R A N G E
$segment = $this->createSegment('fetch_constant_logic');
$constant = $this->createConstant($segment, 'fetch_constant_logic_reference', ['99.90']);
// A C T
$response = $this->actingAsAdmin()
->getJson("/api/v1/segment/{$segment->id}/constant/show/{$constant->reference}");
// A S S E R T
$response->assertStatus(200);
$response->assertJsonPath('payload.data.id', $constant->id);
$response->assertJsonPath('payload.data.reference', 'fetch_constant_logic_reference');
$response->assertJsonPath('payload.data.value.0', '99.90');
}
}