mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-23 14:34:04 +00:00
39 lines
1.2 KiB
PHP
39 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Original controller logic file:
|
|
* app/Classes/Modules/Segments/ControllersLogic/CreateBasePriceLogic.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 CreateBasePriceLogicTest extends SegmentsControllerLogicTestCase
|
|
{
|
|
public function test_it_can_create_or_update_base_price_via_controller_logic()
|
|
{
|
|
// A R R A N G E
|
|
$segment = $this->createSegment();
|
|
$payload = [
|
|
'dateFrom' => '2026-03-01',
|
|
'dateTo' => '2026-03-03',
|
|
'rate' => '12.50',
|
|
];
|
|
|
|
// A C T
|
|
$response = $this->actingAsAdmin()
|
|
->postJson("/api/v1/segment/{$segment->id}/constant/base-price/create", $payload);
|
|
|
|
// A S S E R T
|
|
$response->assertStatus(200);
|
|
$response->assertJsonPath('payload.data.reference', SegmentConstants::BASE_PRICE);
|
|
$response->assertJsonPath('payload.data.value.2026-03-01', '12.50');
|
|
$response->assertJsonPath('payload.data.value.2026-03-03', '12.50');
|
|
}
|
|
}
|