create PM v0.5
This commit is contained in:
parent
9b47296cea
commit
d2ba22c0cf
25 changed files with 2155 additions and 72 deletions
54
tests/Feature/PressReleasePhase7SchemaTest.php
Normal file
54
tests/Feature/PressReleasePhase7SchemaTest.php
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Company;
|
||||
use App\Models\PressRelease;
|
||||
use App\Models\PressReleaseAttachment;
|
||||
|
||||
test('press release accepts new phase 7 fields', function () {
|
||||
$pr = PressRelease::factory()->create([
|
||||
'subtitle' => 'Eine sinnvolle Subline',
|
||||
'boilerplate_override' => 'PM-spezifischer Boilerplate-Text.',
|
||||
'scheduled_at' => now()->addDay(),
|
||||
'embargo_at' => now()->addDays(2),
|
||||
]);
|
||||
|
||||
$fresh = $pr->fresh();
|
||||
|
||||
expect($fresh->subtitle)->toBe('Eine sinnvolle Subline');
|
||||
expect($fresh->boilerplate_override)->toBe('PM-spezifischer Boilerplate-Text.');
|
||||
expect($fresh->scheduled_at)->not->toBeNull();
|
||||
expect($fresh->embargo_at)->not->toBeNull();
|
||||
});
|
||||
|
||||
test('company accepts a boilerplate field', function () {
|
||||
$company = Company::factory()->create([
|
||||
'boilerplate' => 'Über die Beispiel GmbH: gegründet 1900, …',
|
||||
]);
|
||||
|
||||
expect($company->fresh()->boilerplate)->toBe('Über die Beispiel GmbH: gegründet 1900, …');
|
||||
});
|
||||
|
||||
test('press release attachments table works via factory and relation', function () {
|
||||
$pr = PressRelease::factory()->create();
|
||||
|
||||
$attachment = PressReleaseAttachment::factory()->create([
|
||||
'press_release_id' => $pr->id,
|
||||
'original_name' => 'pressemappe.pdf',
|
||||
'mime' => 'application/pdf',
|
||||
'size' => 1_234_567,
|
||||
'sort_order' => 1,
|
||||
]);
|
||||
|
||||
expect($pr->fresh()->attachments)->toHaveCount(1);
|
||||
expect($pr->fresh()->attachments->first()->original_name)->toBe('pressemappe.pdf');
|
||||
expect($attachment->pressRelease->is($pr))->toBeTrue();
|
||||
});
|
||||
|
||||
test('attachment is removed when press release is force-deleted', function () {
|
||||
$pr = PressRelease::factory()->create();
|
||||
PressReleaseAttachment::factory()->for($pr)->create();
|
||||
|
||||
$pr->forceDelete();
|
||||
|
||||
expect(PressReleaseAttachment::query()->withTrashed()->count())->toBe(0);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue