From 7ff735acac25627881346708d997a826812131dd Mon Sep 17 00:00:00 2001 From: Philipp Lang Date: Mon, 15 May 2023 15:12:12 +0200 Subject: [PATCH] Add email column to csv --- app/Member/Actions/ExportAction.php | 3 ++- tests/Feature/Member/ExportCsvActionTest.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Member/Actions/ExportAction.php b/app/Member/Actions/ExportAction.php index 89ba0e62..a83833d2 100644 --- a/app/Member/Actions/ExportAction.php +++ b/app/Member/Actions/ExportAction.php @@ -22,7 +22,7 @@ class ExportAction { $csv = Writer::createFromString(); - $csv->insertOne(['Nachname', 'Vorname', 'Adresse', 'PLZ', 'Ort', 'Haupt-Telefon', 'Mobiltelefon', 'Arbeits-Telefon']); + $csv->insertOne(['Nachname', 'Vorname', 'Adresse', 'PLZ', 'Ort', 'Haupt-Telefon', 'Mobiltelefon', 'Arbeits-Telefon', 'E-Mail-Adresse']); foreach ($members as $member) { $csv->insertOne([ @@ -34,6 +34,7 @@ class ExportAction $member->main_phone, $member->mobile_phone, $member->work_phone, + $member->email, ]); } diff --git a/tests/Feature/Member/ExportCsvActionTest.php b/tests/Feature/Member/ExportCsvActionTest.php index 6a7cf024..744ae59d 100644 --- a/tests/Feature/Member/ExportCsvActionTest.php +++ b/tests/Feature/Member/ExportCsvActionTest.php @@ -19,7 +19,7 @@ class ExportCsvActionTest extends TestCase Storage::fake('temp'); $this->withoutExceptionHandling()->login()->loginNami(); - Member::factory()->defaults()->postBillKind()->create(['firstname' => 'Jane', 'main_phone' => '+49 176 70343221']); + Member::factory()->defaults()->postBillKind()->create(['firstname' => 'Jane', 'main_phone' => '+49 176 70343221', 'email' => 'max@muster.de']); Member::factory()->defaults()->emailBillKind()->create(['firstname' => 'Max']); $response = $this->callFilter('member-export', ['bill_kind' => 'Post']); @@ -28,6 +28,7 @@ class ExportCsvActionTest extends TestCase $contents = Storage::disk('temp')->get('mitglieder.csv'); $this->assertTrue(str_contains($contents, 'Jane')); $this->assertTrue(str_contains($contents, '+49 176 70343221')); + $this->assertTrue(str_contains($contents, 'max@muster.de')); $this->assertFalse(str_contains($contents, 'Max')); } }