mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-29 01:13:59 +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,48 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Unit\Modules\Segments\Services;
|
||||
|
||||
use App\Classes\Modules\Segments\DataTransferObjects\SegmentObject;
|
||||
use App\Classes\Modules\Segments\Services\CreatesSegment;
|
||||
use App\Models\Segment;
|
||||
use App\Classes\ValueObjects\Constants\SegmentConstants;
|
||||
use PHPUnit\Framework\Attributes\Group;
|
||||
use Tests\TestCase;
|
||||
|
||||
#[Group('unit')]
|
||||
#[Group('segments')]
|
||||
#[Group('services')]
|
||||
#[Group('ok_to_run')]
|
||||
class CreatesSegmentTest extends TestCase
|
||||
{
|
||||
// use DatabaseTransactions;
|
||||
|
||||
/**
|
||||
* Test it can create a segment.
|
||||
*
|
||||
* @return void
|
||||
* @throws \App\Classes\Exceptions\MalformedRequestException
|
||||
*/
|
||||
public function test_it_can_create_a_segment()
|
||||
{
|
||||
// A R R A N G E
|
||||
$name = 'test_it_can_create_a_segment';
|
||||
$type = SegmentConstants::STANDARD_SEGMENT;
|
||||
$object = new SegmentObject($name, $type);
|
||||
$service = new CreatesSegment();
|
||||
|
||||
// A C T
|
||||
$result = $service->execute($object);
|
||||
|
||||
// A S S E R T
|
||||
$this->assertInstanceOf(Segment::class, $result);
|
||||
$this->assertEquals($name, $result->name);
|
||||
$this->assertEquals($type, $result->type);
|
||||
|
||||
$this->assertDatabaseHas('segments', [
|
||||
'id' => $result->id,
|
||||
'name' => $name,
|
||||
'type' => $type,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user