mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-23 22:44:08 +00:00
38 lines
1.2 KiB
PHP
38 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* Original controller logic file:
|
|
* app/Classes/Modules/Segments/ControllersLogic/ListSegmentLogic.php
|
|
*/
|
|
|
|
namespace Tests\Feature\Segments\ControllersLogic;
|
|
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
|
|
#[Group('feature')]
|
|
#[Group('segments')]
|
|
#[Group('controllers_logic')]
|
|
#[Group('ok_to_run')]
|
|
class ListSegmentLogicTest extends SegmentsControllerLogicTestCase
|
|
{
|
|
public function test_it_can_list_segments_via_controller_logic()
|
|
{
|
|
// A R R A N G E
|
|
$companyModuleId = mt_rand(100000, 999999);
|
|
$matchingSegment = $this->createSegment('list_segment_logic_matching_segment', $companyModuleId);
|
|
$this->createSegment('list_segment_logic_other_segment', $companyModuleId + 1);
|
|
$filters = json_encode([
|
|
'company_module_id' => $companyModuleId,
|
|
]);
|
|
|
|
// A C T
|
|
$response = $this->actingAsAdmin()
|
|
->getJson('/api/v1/segment/list?filters=' . urlencode($filters));
|
|
|
|
// A S S E R T
|
|
$response->assertStatus(200);
|
|
$response->assertJsonCount(1, 'payload.data');
|
|
$response->assertJsonPath('payload.data.0.id', $matchingSegment->id);
|
|
$response->assertJsonPath('payload.data.0.name', 'List Segment Logic Matching Segment');
|
|
}
|
|
}
|