mirror of
https://github.com/coollabsio/coolify.git
synced 2026-11-04 18:52:49 +00:00
Co-authored-by: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com> Co-authored-by: Aditya Tripathi <aditya@climactic.co> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
1001 B
PHP
26 lines
1001 B
PHP
<?php
|
|
|
|
it('formats values so that parseEnvFormatToArray reads them back unchanged', function (string $value) {
|
|
$formatted = formatEnvValueForDevView($value);
|
|
|
|
expect(parseEnvFormatToArray("KEY={$formatted}"))
|
|
->toBe(['KEY' => ['value' => $value, 'comment' => null]]);
|
|
})->with([
|
|
'plain' => ['plain-value'],
|
|
'empty' => [''],
|
|
'double quoted' => ['"abc"'],
|
|
'single quoted' => ["'\$FOO'"],
|
|
'leading double quote only' => ['"abc'],
|
|
'quotes inside' => ['He said "hi" and \'bye\''],
|
|
'hash after whitespace' => ['value #not-a-comment'],
|
|
'hash without whitespace' => ['value#hash'],
|
|
'double quoted with suffix' => ['"Company :: App" <noreply@example.com>'],
|
|
]);
|
|
|
|
it('returns null for values that the env format cannot hold', function (string $value) {
|
|
expect(formatEnvValueForDevView($value))->toBeNull();
|
|
})->with([
|
|
'both quote types and a leading quote' => ['\'"Company :: App" <noreply@example.com>\''],
|
|
'line break' => ["first\nsecond"],
|
|
]);
|