Add email column to csv
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details

This commit is contained in:
Philipp Lang 2023-05-15 15:12:12 +02:00
parent ef0672334c
commit 7ff735acac
2 changed files with 4 additions and 2 deletions

View File

@ -22,7 +22,7 @@ class ExportAction
{ {
$csv = Writer::createFromString(); $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) { foreach ($members as $member) {
$csv->insertOne([ $csv->insertOne([
@ -34,6 +34,7 @@ class ExportAction
$member->main_phone, $member->main_phone,
$member->mobile_phone, $member->mobile_phone,
$member->work_phone, $member->work_phone,
$member->email,
]); ]);
} }

View File

@ -19,7 +19,7 @@ class ExportCsvActionTest extends TestCase
Storage::fake('temp'); Storage::fake('temp');
$this->withoutExceptionHandling()->login()->loginNami(); $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']); Member::factory()->defaults()->emailBillKind()->create(['firstname' => 'Max']);
$response = $this->callFilter('member-export', ['bill_kind' => 'Post']); $response = $this->callFilter('member-export', ['bill_kind' => 'Post']);
@ -28,6 +28,7 @@ class ExportCsvActionTest extends TestCase
$contents = Storage::disk('temp')->get('mitglieder.csv'); $contents = Storage::disk('temp')->get('mitglieder.csv');
$this->assertTrue(str_contains($contents, 'Jane')); $this->assertTrue(str_contains($contents, 'Jane'));
$this->assertTrue(str_contains($contents, '+49 176 70343221')); $this->assertTrue(str_contains($contents, '+49 176 70343221'));
$this->assertTrue(str_contains($contents, 'max@muster.de'));
$this->assertFalse(str_contains($contents, 'Max')); $this->assertFalse(str_contains($contents, 'Max'));
} }
} }