HEX
Server: LiteSpeed
System: Linux s1049.use1.mysecurecloudhost.com 4.18.0-477.27.2.lve.el8.x86_64 #1 SMP Wed Oct 11 12:32:56 UTC 2023 x86_64
User: xedaptot (3356)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: /home/xedaptot/be.naniguide.com/tests/Feature/CampaignFlowFeatureTest.php
<?php

/**
 * Campaign business logic feature tests.
 */

use App\Model\Campaign;

test('campaign status constants are defined', function () {
    expect(Campaign::STATUS_NEW)->toBe('new');
    expect(Campaign::STATUS_SENDING)->toBe('sending');
    expect(Campaign::STATUS_DONE)->toBe('done');
    expect(Campaign::STATUS_QUEUED)->toBe('queued');
    expect(Campaign::STATUS_SCHEDULED)->toBe('scheduled');
});

test('campaign has required fillable fields', function () {
    $campaign = new Campaign();
    $fillable = $campaign->getFillable();

    expect($fillable)->toContain('name');
    expect($fillable)->toContain('subject');
    expect($fillable)->toContain('from_email');
    expect($fillable)->toContain('from_name');
    expect($fillable)->toContain('reply_to');
});

test('campaign model can be instantiated with attributes', function () {
    $campaign = new Campaign([
        'name' => 'Spring Sale 2026',
        'subject' => 'Big Savings Inside!',
        'from_email' => '[email protected]',
        'from_name' => 'Sales Team',
        'reply_to' => '[email protected]',
    ]);
    $campaign->status = Campaign::STATUS_NEW;

    expect($campaign->name)->toBe('Spring Sale 2026');
    expect($campaign->subject)->toBe('Big Savings Inside!');
    expect($campaign->status)->toBe(Campaign::STATUS_NEW);
});