mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-23 14:34:04 +00:00
41 lines
1.1 KiB
PHP
41 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* Original controller logic file:
|
|
* app/Classes/Modules/Segments/ControllersLogic/CreateSegmentLogic.php
|
|
*/
|
|
|
|
namespace Tests\Feature\Segments\ControllersLogic;
|
|
|
|
use App\Models\Segment;
|
|
use PHPUnit\Framework\Attributes\Group;
|
|
|
|
#[Group('feature')]
|
|
#[Group('segments')]
|
|
#[Group('controllers_logic')]
|
|
#[Group('ok_to_run')]
|
|
class CreateSegmentLogicTest extends SegmentsControllerLogicTestCase
|
|
{
|
|
public function test_it_can_create_a_segment_via_controller_logic()
|
|
{
|
|
// A R R A N G E
|
|
$testName = 'create_segment_logic';
|
|
$payload = [
|
|
'name' => $testName,
|
|
];
|
|
|
|
// A C T
|
|
$response = $this->actingAsAdmin()
|
|
->postJson('/api/v1/segment/create', $payload);
|
|
|
|
// A S S E R T
|
|
$response->assertStatus(200);
|
|
$response->assertJsonPath('payload.data.name', ucwords(str_replace('_', ' ', $testName)));
|
|
|
|
$segment = Segment::query()->latest('id')->first();
|
|
|
|
$this->assertNotNull($segment);
|
|
$this->assertSame($testName, $segment->name);
|
|
$this->assertEquals(1, $segment->company_module_id);
|
|
}
|
|
}
|