From db30e6527147d0486f742af04b7e44a8c592658f Mon Sep 17 00:00:00 2001 From: "sweep-ai[bot]" <128439645+sweep-ai[bot]@users.noreply.github.com> Date: Fri, 19 Jul 2024 22:29:00 +0000 Subject: [PATCH] Updated 1 files --- tests/Unit/GedcomExporterTest.php | 80 +------------------------------ 1 file changed, 1 insertion(+), 79 deletions(-) diff --git a/tests/Unit/GedcomExporterTest.php b/tests/Unit/GedcomExporterTest.php index a9bce46..4280fb3 100644 --- a/tests/Unit/GedcomExporterTest.php +++ b/tests/Unit/GedcomExporterTest.php @@ -1,84 +1,7 @@ -setupExportTestEnvironment('test'); - $this->verifyExportedFileExists('test.GED'); - } - - public function testExportingDataWithMockDatabaseRecords() - { - $this->setupExportTestEnvironment('mockData'); - $this->verifyExportedFileExists('mockData.GED'); - } - - public function testHandlingOfFileWriteErrors() - { - Storage::shouldReceive('makeDirectory')->andThrow(new \Exception('Failed to create directory')); - $this->expectException(\Exception::class); - $this->expectExceptionMessage('Failed to create directory'); - - $this->artisan('gedcom:export', ['filename' => 'errorCase']) - ->assertExitCode(1); - } - - private function setupExportTestEnvironment($filename) - { - Storage::fake('local'); - $this->artisan('gedcom:export', ['filename' => $filename]) - ->assertExitCode(0); - } - - private function verifyExportedFileExists($filename) - { - Storage::disk('local')->assertExists('public/gedcom/exported/' . $filename); - } - - - /** - * @dataProvider exportDataProvider - */ - public function testExportingData($data, $expected) - { - DB::shouldReceive('table')->andReturnSelf(); - View::shouldReceive('make')->andReturnSelf()->shouldReceive('render')->andReturn($expected); - - $this->artisan('gedcom:export', ['filename' => 'exportTest'])->assertExitCode(0); - - Storage::disk('local')->assertExists('public/gedcom/exported/exportTest.GED'); - $this->assertStringContainsString($expected, Storage::disk('local')->get('public/gedcom/exported/exportTest.GED')); - } - - public function exportDataProvider() + public static function exportDataProvider() { return [ 'individuals' => [ - /** - * Verifies that the exported GEDCOM file exists in the specified storage location. - * - * @param string $filename The name of the exported file to verify. - */ - /** - * Sets up the environment for exporting a GEDCOM file. - * This includes faking the local storage and asserting the exit code of the artisan command. - * - * @param string $filename The name of the file to be exported. - */ - /** - * Verifies that the exported GEDCOM file exists in the specified storage disk. - * - * @param string $filename The name of the exported file to check. - */ ['type' => 'individuals', 'data' => ['name' => 'John Doe']], "0 @I1@ INDI\n1 NAME John Doe\n" ], @@ -95,5 +18,4 @@ public function exportDataProvider() "0 @M1@ OBJE\n1 TITL Photo of John Doe\n" ], ]; - } } \ No newline at end of file