mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-21 13:33:57 +00:00
Update: laravel 8 to 12, php 7.3 to php 8.3, Jenkinsfile, Unit/Feature testing, vapor, docker
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Modules\Segments\Services;
|
||||
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Services\UpdatesSegment;
|
||||
use App\Models\Segment;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\TestCase;
|
||||
|
||||
#[Group('unit')]
|
||||
#[Group('segments')]
|
||||
#[Group('services')]
|
||||
#[Group('ok_to_run')]
|
||||
class UpdatesSegmentTest extends TestCase
|
||||
{
|
||||
// use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Test it can update a segment.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function test_it_can_update_a_segment()
|
||||
{
|
||||
// A R R A N G E
|
||||
$segment = new Segment();
|
||||
$segment->name = 'test_it_can_update_a_segment_ORIGINAL';
|
||||
$segment->save();
|
||||
|
||||
$newName = 'test_it_can_update_a_segment_UPDATED';
|
||||
$object = new SegmentObject($newName);
|
||||
$service = new UpdatesSegment();
|
||||
|
||||
// A C T
|
||||
$result = $service->execute($segment, $object);
|
||||
|
||||
// A S S E R T
|
||||
$this->assertInstanceOf(Segment::class, $result);
|
||||
$this->assertEquals($newName, $result->name);
|
||||
$this->assertEquals($segment->id, $result->id);
|
||||
|
||||
$this->assertDatabaseHas('segments', [
|
||||
'id' => $segment->id,
|
||||
'name' => $newName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user