Skip to content

Commit

Permalink
Updated 1 files
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] authored Jul 28, 2024
1 parent bc76722 commit 91e9752
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion tests/Unit/GedcomExporterTest.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
<?php

namespace Tests\Unit;

use FamilyTree365\LaravelGedcom\Commands\GedcomExporter;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
use Mockery;

class GedcomExporterTest extends TestCase
{
public function setUp(): void
{
parent::setUp();
Storage::fake('local');
}

public function testHandlingOfFileWriteErrors()
{
Storage::shouldReceive('put')
->once()
->andThrow(new \Exception('Failed to write file'));

$this->artisan('gedcom:export', ['filename' => 'test_export'])
->expectsOutput('An error occurred while exporting the GEDCOM file: Failed to write file')
->assertExitCode(1);
}

public static function exportDataProvider()
{
return [
Expand All @@ -18,4 +46,11 @@ public static function exportDataProvider()
"0 @M1@ OBJE\n1 TITL Photo of John Doe\n"
],
];
}
}

public function tearDown(): void
{
Mockery::close();
parent::tearDown();
}
}

0 comments on commit 91e9752

Please sign in to comment.