- 83 Komponenten: Livewire\Volt\Component → Livewire\Component
- 73 Routen (admin, auth, customer): Volt::route() → Route::livewire()
- 88 Testdateien: Volt::test/actingAs → Livewire::test/actingAs
- VoltServiceProvider gelöscht; composer remove livewire/volt
- config/livewire.php auf v4-Schlüssel (component_layout, component_placeholder,
component_locations, make_command: SFC ohne ⚡). Der alte Schlüssel layout war
wirkungslos; alle gerouteten Komponenten setzen ihr Layout selbst.
- CLAUDE.md, AGENTS.md, boost.json, .cursorrules, Skill volt-development
- Roadmap: erledigt; Larastan erfasst SFCs weiterhin nicht (Blade-Dateien)
Suite 2.325 grün, einer übersprungen; Larastan und Pint ohne Meldung;
route:cache und view:cache laufen.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
167 lines
5.7 KiB
PHP
167 lines
5.7 KiB
PHP
<?php
|
|
|
|
use App\Enums\PressReleaseStatus;
|
|
use App\Models\Category;
|
|
use App\Models\Company;
|
|
use App\Models\Contact;
|
|
use App\Models\PressRelease;
|
|
use App\Models\User;
|
|
use Database\Seeders\RolesAndPermissionsSeeder;
|
|
use Livewire\Livewire;
|
|
use Tests\TestCase;
|
|
|
|
beforeEach(function (): void {
|
|
/** @var TestCase $this */
|
|
$this->seed(RolesAndPermissionsSeeder::class);
|
|
});
|
|
|
|
/**
|
|
* @return array{customer: User, company: Company, contact: Contact, category: Category}
|
|
*/
|
|
function makeCustomerForContactWarning(): array
|
|
{
|
|
$customer = User::factory()->create(['is_active' => true]);
|
|
$customer->assignRole('customer');
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$customer->companies()->attach($company->id, ['role' => 'owner']);
|
|
|
|
$contact = Contact::factory()->for($company)->create([
|
|
'portal' => $company->portal->value,
|
|
'phone' => '+49 30 1234567',
|
|
]);
|
|
$category = Category::factory()->create();
|
|
|
|
return compact('customer', 'company', 'contact', 'category');
|
|
}
|
|
|
|
function makeAdminForContactWarning(): User
|
|
{
|
|
$admin = User::factory()->create(['is_active' => true]);
|
|
$admin->assignRole('admin');
|
|
|
|
return $admin;
|
|
}
|
|
|
|
test('customer create zeigt Warn-Box, wenn kein Pressekontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'company' => $company] = makeCustomerForContactWarning();
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.create')
|
|
->set('companyId', $company->id)
|
|
->set('contactId', null)
|
|
->assertSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|
|
|
|
test('customer create zeigt Warn-Box NICHT, wenn ein Kontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'company' => $company, 'contact' => $contact] = makeCustomerForContactWarning();
|
|
$this->actingAs($customer);
|
|
|
|
Livewire::test('customer.press-releases.create')
|
|
->set('companyId', $company->id)
|
|
->set('contactId', $contact->id)
|
|
->assertDontSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|
|
|
|
test('customer edit zeigt Warn-Box, wenn kein Pressekontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'company' => $company, 'category' => $category] = makeCustomerForContactWarning();
|
|
$this->actingAs($customer);
|
|
|
|
$pr = PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'category_id' => $category->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Draft->value,
|
|
]);
|
|
|
|
Livewire::test('customer.press-releases.edit', ['id' => $pr->id])
|
|
->set('contactId', null)
|
|
->assertSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|
|
|
|
test('customer edit zeigt Warn-Box NICHT, wenn ein Kontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
['customer' => $customer, 'company' => $company, 'contact' => $contact, 'category' => $category] = makeCustomerForContactWarning();
|
|
$this->actingAs($customer);
|
|
|
|
$pr = PressRelease::factory()->create([
|
|
'user_id' => $customer->id,
|
|
'company_id' => $company->id,
|
|
'category_id' => $category->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Draft->value,
|
|
]);
|
|
$pr->contacts()->sync([$contact->id]);
|
|
|
|
Livewire::test('customer.press-releases.edit', ['id' => $pr->id])
|
|
->assertDontSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|
|
|
|
test('admin create zeigt Warn-Box, wenn kein Pressekontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForContactWarning();
|
|
$this->actingAs($admin);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
Contact::factory()->for($company)->create([
|
|
'portal' => $company->portal->value,
|
|
'phone' => '+49 30 7654321',
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.create')
|
|
->set('companyId', $company->id)
|
|
->set('contactId', null)
|
|
->assertSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|
|
|
|
test('admin edit zeigt Warn-Box, wenn kein Pressekontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForContactWarning();
|
|
$this->actingAs($admin);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
Contact::factory()->for($company)->create([
|
|
'portal' => $company->portal->value,
|
|
'phone' => '+49 30 7654321',
|
|
]);
|
|
$category = Category::factory()->create();
|
|
|
|
$pr = PressRelease::factory()->create([
|
|
'company_id' => $company->id,
|
|
'category_id' => $category->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Draft->value,
|
|
]);
|
|
|
|
Livewire::test('admin.press-releases.edit', ['id' => $pr->id])
|
|
->set('contactId', null)
|
|
->assertSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|
|
|
|
test('admin edit zeigt Warn-Box NICHT, wenn ein Kontakt gewählt ist', function () {
|
|
/** @var TestCase $this */
|
|
$admin = makeAdminForContactWarning();
|
|
$this->actingAs($admin);
|
|
|
|
$company = Company::factory()->presseecho()->create();
|
|
$contact = Contact::factory()->for($company)->create([
|
|
'portal' => $company->portal->value,
|
|
'phone' => '+49 30 7654321',
|
|
]);
|
|
$category = Category::factory()->create();
|
|
|
|
$pr = PressRelease::factory()->create([
|
|
'company_id' => $company->id,
|
|
'category_id' => $category->id,
|
|
'portal' => $company->portal->value,
|
|
'status' => PressReleaseStatus::Draft->value,
|
|
]);
|
|
$pr->contacts()->sync([$contact->id]);
|
|
|
|
Livewire::test('admin.press-releases.edit', ['id' => $pr->id])
|
|
->assertDontSee('Noch kein Pressekontakt ausgewählt');
|
|
});
|