mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-23 14:34:04 +00:00
41 lines
1.2 KiB
PHP
41 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Original controller logic file:
|
|
* app/Classes/Modules/Segments/ControllersLogic/UpdateSegmentLogic.php
|
|
*/
|
|
|
|
namespace Tests\Feature\Segments\ControllersLogic;
|
|
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
|
|
#[Group('feature')]
|
|
#[Group('segments')]
|
|
#[Group('controllers_logic')]
|
|
#[Group('ok_to_run')]
|
|
class UpdateSegmentLogicTest extends SegmentsControllerLogicTestCase
|
|
{
|
|
// Note: no where is actually using UpdateSegmentLogic, see UpdateSegmentPriceLogic is in used
|
|
public function test_it_can_update_a_segment_via_controller_logic()
|
|
{
|
|
// A R R A N G E
|
|
$segment = $this->createSegment('update_segment_logic_old_name');
|
|
$payload = [
|
|
'name' => 'update_segment_logic_renamed_segment',
|
|
];
|
|
|
|
// A C T
|
|
$response = $this->actingAsAdmin()
|
|
->putJson("/api/v1/segment/update/{$segment->id}", $payload);
|
|
|
|
// A S S E R T
|
|
$response->assertStatus(422); //because the permission table does not defined -> edit segment
|
|
|
|
$response->assertJsonPath('title', 'Updated Segment failed');
|
|
|
|
$this->assertDatabaseHas('segments', [
|
|
'id' => $segment->id,
|
|
'name' => 'update_segment_logic_old_name',
|
|
]);
|
|
}
|
|
}
|