- 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
74 lines
2.1 KiB
PHP
74 lines
2.1 KiB
PHP
<?php
|
|
|
|
use App\Models\Classification;
|
|
use App\Models\Company;
|
|
use App\Models\ContentRecap;
|
|
use App\Models\Department;
|
|
use App\Models\IssueManagement;
|
|
use App\Models\Journalist;
|
|
use App\Models\Location;
|
|
use App\Models\MediaMonitoring;
|
|
use App\Models\PartnerMedia;
|
|
use App\Models\Theme;
|
|
use App\Models\User;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
|
|
uses(RefreshDatabase::class);
|
|
|
|
describe('Model Factory Tests', function () {
|
|
it('can create user', function () {
|
|
$user = User::factory()->create();
|
|
expect($user->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create theme', function () {
|
|
$theme = Theme::factory()->create();
|
|
expect($theme->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create classification', function () {
|
|
$classification = Classification::factory()->create();
|
|
expect($classification->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create location', function () {
|
|
$location = Location::factory()->create();
|
|
expect($location->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create department', function () {
|
|
$department = Department::factory()->create();
|
|
expect($department->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create company', function () {
|
|
$company = Company::factory()->create();
|
|
expect($company->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create partner media', function () {
|
|
$partnerMedia = PartnerMedia::factory()->create();
|
|
expect($partnerMedia->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create journalist', function () {
|
|
$journalist = Journalist::factory()->create();
|
|
expect($journalist->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create media monitoring', function () {
|
|
$mediaMonitoring = MediaMonitoring::factory()->create();
|
|
expect($mediaMonitoring->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create content recap', function () {
|
|
$contentRecap = ContentRecap::factory()->create();
|
|
expect($contentRecap->exists)->toBeTrue();
|
|
});
|
|
|
|
it('can create issue management', function () {
|
|
$issueManagement = IssueManagement::factory()->create();
|
|
expect($issueManagement->exists)->toBeTrue();
|
|
});
|
|
});
|