- Add HasFactory trait to all model classes for factory support - Create factory classes for all models (Classification, Company, ContentRecap, Department, IssueManagement, Journalist, Location, MediaMonitoring, MediaMonitoringTheme, PartnerMedia, SubClassification, SubLocation, Theme, User) - Add unit tests for all models with relationship and attribute validation - Add unit tests for all enums (Channel, ContentType, IsActive, IssueSentiment, MediaClassification, MediaType, SocialMedia) - Add feature tests for factory integration and basic application functionality - Add tests for Filament actions, columns, and media library utilities - Add tests for model policies (Classification, Theme) and traits (WithComment, WithValue) - Update phpunit.xml configuration for test environment - Add test documentation and working tests reference guide - Add ContentType enum casting to ContentRecap model - Add MediaMonitoringTheme relationships and factory support - Establish comprehensive testing infrastructure for improved code quality and reliability
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
use App\Enums\IsActive;
|
|
|
|
describe('IsActive Enum', function () {
|
|
it('has correct active status cases', function () {
|
|
$cases = IsActive::cases();
|
|
|
|
expect($cases)->toHaveCount(2)
|
|
->and(collect($cases)->pluck('value')->toArray())
|
|
->toEqual([1, 2]);
|
|
});
|
|
|
|
it('can get value from case', function () {
|
|
expect(IsActive::ACTIVE->value)->toBe(1)
|
|
->and(IsActive::INACTIVE->value)->toBe(2);
|
|
});
|
|
|
|
it('can get label from case', function () {
|
|
expect(IsActive::ACTIVE->getLabel())->toBe('Aktif')
|
|
->and(IsActive::INACTIVE->getLabel())->toBe('Tidak Aktif');
|
|
});
|
|
|
|
it('can get color from case', function () {
|
|
expect(IsActive::ACTIVE->getColor())->toBe('success')
|
|
->and(IsActive::INACTIVE->getColor())->toBe('danger');
|
|
});
|
|
|
|
it('can get options array', function () {
|
|
$options = IsActive::options();
|
|
|
|
expect($options)->toBeArray()
|
|
->and($options)->toHaveKey(1, 'Aktif')
|
|
->and($options)->toHaveKey(2, 'Tidak Aktif');
|
|
});
|
|
});
|