From b3b251bae289d474937865a7a7f6ebc5a37c4059 Mon Sep 17 00:00:00 2001 From: Benjamin Nussbaum Date: Mon, 22 Sep 2025 09:04:56 +0200 Subject: [PATCH] ci: fix --- tests/Feature/PluginImportTest.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tests/Feature/PluginImportTest.php b/tests/Feature/PluginImportTest.php index 9a7293d..86b9220 100644 --- a/tests/Feature/PluginImportTest.php +++ b/tests/Feature/PluginImportTest.php @@ -250,10 +250,10 @@ it('imports plugin from GitHub monorepo with repository-named directory', functi // Create a mock ZIP file that simulates GitHub's ZIP structure with repository-named directory $zipContent = createMockZipFile([ + 'example-repo-main/another-plugin/src/settings.yml' => "name: Other Plugin\nrefresh_interval: 60\nstrategy: static\npolling_verb: get\nstatic_data: '{}'\ncustom_fields: []", + 'example-repo-main/another-plugin/src/full.liquid' => '
Other content
', 'example-repo-main/example-plugin/src/settings.yml' => getValidSettingsYaml(), 'example-repo-main/example-plugin/src/full.liquid' => getValidFullLiquid(), - 'example-repo-main/other-plugin/src/settings.yml' => "name: Other Plugin\nrefresh_interval: 60\nstrategy: static\npolling_verb: get\nstatic_data: '{}'\ncustom_fields: []", - 'example-repo-main/other-plugin/src/full.liquid' => '
Other content
', ]); // Mock the HTTP response @@ -265,7 +265,7 @@ it('imports plugin from GitHub monorepo with repository-named directory', functi $plugin = $pluginImportService->importFromUrl( 'https://github.com/example/repo/archive/refs/heads/main.zip', $user, - 'example-plugin' + 'example-repo-main/example-plugin' ); expect($plugin)->toBeInstanceOf(Plugin::class) @@ -306,7 +306,7 @@ it('finds required files in GitHub monorepo structure with zip_entry_path', func $zipFile = UploadedFile::fake()->createWithContent('monorepo.zip', $zipContent); $pluginImportService = new PluginImportService(); - $plugin = $pluginImportService->importFromZip($zipFile, $user, 'example-plugin'); + $plugin = $pluginImportService->importFromZip($zipFile, $user, 'example-repo-main/example-plugin'); expect($plugin)->toBeInstanceOf(Plugin::class) ->and($plugin->user_id)->toBe($user->id) @@ -329,7 +329,7 @@ it('imports specific plugin from monorepo zip with zip_entry_path parameter', fu $zipFile = UploadedFile::fake()->createWithContent('monorepo.zip', $zipContent); $pluginImportService = new PluginImportService(); - + // This test will fail because importFromZip doesn't support zip_entry_path parameter yet // The logic needs to be implemented to specify which plugin to import from the monorepo $plugin = $pluginImportService->importFromZip($zipFile, $user, 'example-plugin2'); @@ -345,7 +345,9 @@ it('imports specific plugin from monorepo zip with zip_entry_path parameter', fu function createMockZipFile(array $files): string { $zip = new ZipArchive(); - $tempFile = tempnam(sys_get_temp_dir(), 'test_zip_'); + + $tempFileName = 'test_zip_'.uniqid().'.zip'; + $tempFile = Storage::path($tempFileName); $zip->open($tempFile, ZipArchive::CREATE); @@ -356,7 +358,8 @@ function createMockZipFile(array $files): string $zip->close(); $content = file_get_contents($tempFile); - unlink($tempFile); + + Storage::delete($tempFileName); return $content; }