New Phase C test files: - tests/Unit/Models/Artist/ArtistDomainModelsTest.php — relationships, casts, soft-delete trait presence, slug uniqueness within/across organisations, isParked() helper, AdvanceSection's primary scope, PURPOSE_SUBJECT_FQCN['artist'] resolves to instantiable class. - tests/Feature/Artist/ArtistEngagementObserverTest.php — auto-fill organisation_id from artist, cross-tenant guard throws, soft-delete cascades to performances + hard-deletes advance_sections. - tests/Feature/Artist/PerformanceObserverTest.php — version starts at 0, increments by 1 per UPDATE, no bump on no-op save. - tests/Feature/Artist/ArtistDomainScopeLeakageTest.php — 5 scoped models (Artist/Genre/Engagement direct + Stage/Performance FK-chain) isolate cross-org queries. - tests/Feature/Artist/ArtistTimetableDevSeederTest.php — fixture-count smoke (4 stages, 12 stage_days, 6 artists, 12 engagements, 13 performances incl. 1 parked). Cross-cutting fixes that Phase C surfaced: - AppServiceProvider: morph-map block 2 extended with the 8 new artist-domain models (artist_engagement, artist_contact, genre, stage, stage_day, performance, advance_section, advance_submission). Block 1 'artist' alias was already wired via PurposeRegistry. - 5 form-builder backfill tests bumped --step rollback counts by +10 to account for the 10 new May 8 migrations sitting at HEAD between the test's calibration point and current head. - phpstan-baseline.neon regenerated (1631 entries) — all errors are same patterns existing baselined code already exhibits (Factory generic typing, Model property docblock gaps). Tracked systematically under TECH-LARASTAN-* in BACKLOG. Tests: 1646 passing (was 1624 pre-Session-1 → +22 net, no losses). Larastan: 0 errors over baseline. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
61 lines
2.3 KiB
PHP
61 lines
2.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Tests\Feature\Artist;
|
|
|
|
use App\Models\Artist;
|
|
use App\Models\ArtistContact;
|
|
use App\Models\ArtistEngagement;
|
|
use App\Models\Event;
|
|
use App\Models\Genre;
|
|
use App\Models\Organisation;
|
|
use App\Models\Performance;
|
|
use App\Models\Scopes\OrganisationScope;
|
|
use App\Models\Stage;
|
|
use App\Models\StageDay;
|
|
use Database\Seeders\ArtistTimetableDevSeeder;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
final class ArtistTimetableDevSeederTest extends TestCase
|
|
{
|
|
use RefreshDatabase;
|
|
|
|
public function test_seeder_produces_expected_fixture_counts(): void
|
|
{
|
|
$org = Organisation::factory()->create();
|
|
/** @var Event $festival */
|
|
$festival = Event::factory()->for($org)->festival()->create([
|
|
'start_date' => '2026-07-10',
|
|
'end_date' => '2026-07-12',
|
|
]);
|
|
$vrijdag = Event::factory()->for($org)->subEvent($festival)->create([
|
|
'start_date' => '2026-07-10',
|
|
'end_date' => '2026-07-10',
|
|
]);
|
|
$zaterdag = Event::factory()->for($org)->subEvent($festival)->create([
|
|
'start_date' => '2026-07-11',
|
|
'end_date' => '2026-07-11',
|
|
]);
|
|
$zondag = Event::factory()->for($org)->subEvent($festival)->create([
|
|
'start_date' => '2026-07-12',
|
|
'end_date' => '2026-07-12',
|
|
]);
|
|
|
|
ArtistTimetableDevSeeder::seedForFestival($org, $festival, [$vrijdag, $zaterdag, $zondag]);
|
|
|
|
$this->assertSame(4, Genre::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(4, Stage::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(12, StageDay::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(6, Artist::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(6, ArtistContact::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(12, ArtistEngagement::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(13, Performance::withoutGlobalScope(OrganisationScope::class)->count());
|
|
$this->assertSame(
|
|
1,
|
|
Performance::withoutGlobalScope(OrganisationScope::class)->whereNull('stage_id')->count()
|
|
);
|
|
}
|
|
}
|