tests: gemeinsamer Testhelfer, DB_URL-Guard vor RefreshDatabase, Larastan voller Scope ohne Meldung (Umsetzungsaudit 29.09.: Q-01, Q-02; 02.10.: O02)
- makeCustomerForShowPhase8a() nach tests/Pest.php — die Suite läuft damit auch parallel (--parallel) und dateiweise grün - phpunit.xml leert DB_URL, der Guard in TestCase::setUpTraits() bricht bei gesetzter url ab, bevor RefreshDatabase eine Verbindung öffnet - HasUniqueSlug ohne widersprüchliche @var-Annotation Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
98c465b691
commit
dfb0513e73
6 changed files with 74 additions and 34 deletions
|
|
@ -4,9 +4,6 @@ use App\Enums\Portal;
|
|||
use App\Enums\PressReleaseClassification;
|
||||
use App\Enums\PressReleaseContentTier;
|
||||
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;
|
||||
|
|
@ -18,35 +15,6 @@ beforeEach(function (): void {
|
|||
$this->seed(RolesAndPermissionsSeeder::class);
|
||||
});
|
||||
|
||||
/**
|
||||
* @return array{customer: User, company: Company, contact: Contact, category: Category, pr: PressRelease}
|
||||
*/
|
||||
function makeCustomerForShowPhase8a(array $prAttributes = []): 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,
|
||||
]);
|
||||
$category = Category::factory()->create();
|
||||
|
||||
$pr = PressRelease::factory()->create(array_merge([
|
||||
'user_id' => $customer->id,
|
||||
'company_id' => $company->id,
|
||||
'category_id' => $category->id,
|
||||
'portal' => $company->portal->value,
|
||||
'status' => 'draft',
|
||||
], $prAttributes));
|
||||
|
||||
$pr->contacts()->sync([$contact->id]);
|
||||
|
||||
return compact('customer', 'company', 'contact', 'category', 'pr');
|
||||
}
|
||||
|
||||
function makeAdminForShowPhase8a(): User
|
||||
{
|
||||
$admin = User::factory()->create(['is_active' => true]);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue