Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix(helpers): prevent warnings when loading database helpers

Andras Bacsaibd71b09946bc
diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.php
index 8f4f373b76..03a2e4fa3d 100644
--- a/bootstrap/helpers/databases.php
+++ b/bootstrap/helpers/databases.php
@@ -17,10 +17,8 @@ use App\Models\SwarmDocker;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
-use RuntimeException;
use Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException;
use Symfony\Component\HttpFoundation\StreamedResponse;
-use Throwable;
function create_standalone_postgresql($environmentId, StandaloneDocker|SwarmDocker $destination, ?array $otherData = null, string $databaseImage = 'postgres:16-alpine'): StandalonePostgresql
{
diff --git a/tests/Unit/HelperSyntaxTest.php b/tests/Unit/HelperSyntaxTest.php
new file mode 100644
index 0000000000..e4c0af235d
--- /dev/null
+++ b/tests/Unit/HelperSyntaxTest.php
@@ -0,0 +1,20 @@
+<?php
+
+use Symfony\Component\Process\Process;
+
+it('loads the database helper without PHP warnings', function () {
+ $process = new Process([
+ PHP_BINARY,
+ '-d',
+ 'display_errors=1',
+ '-d',
+ 'error_reporting=E_ALL',
+ '-l',
+ __DIR__.'/../../bootstrap/helpers/databases.php',
+ ]);
+
+ $process->run();
+
+ expect($process->isSuccessful())->toBeTrue()
+ ->and($process->getOutput().$process->getErrorOutput())->not->toContain('Warning');
+});