-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_quote_preservation.php
More file actions
44 lines (37 loc) Β· 1.54 KB
/
test_quote_preservation.php
File metadata and controls
44 lines (37 loc) Β· 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
echo "=== Testing Quote Preservation Fix ===\n\n";
// Clean up any existing test files
if (file_exists('.env')) unlink('.env');
if (file_exists('.env.example')) unlink('.env.example');
// Create source .env file with quoted values
file_put_contents('.env',
'APP_NAME="My Application"
VITE_APP_NAME="${APP_NAME}"
DATABASE_URL="mysql://user:pass@localhost/db"
SIMPLE_VALUE=unquoted
SPACED_VALUE="Value with spaces"
DOLLAR_VALUE="${OTHER_VAR}/path"
');
// Create target .env.example with different values but should preserve quoting
file_put_contents('.env.example',
'APP_NAME="Example App"
VITE_APP_NAME="${OLD_APP_NAME}"
DATABASE_URL="mysql://example:pass@localhost/example"
SIMPLE_VALUE=different
SPACED_VALUE="Different spaced value"
DOLLAR_VALUE="${DIFFERENT_VAR}/path"
');
echo "π Created .env (source with quotes):\n";
echo file_get_contents('.env');
echo "\nπ Created .env.example (target):\n";
echo file_get_contents('.env.example');
echo "\nπ Expected behavior after sync:\n";
echo "- APP_NAME should remain quoted: \"My Application\"\n";
echo "- VITE_APP_NAME should remain quoted: \"\${APP_NAME}\"\n";
echo "- DATABASE_URL should remain quoted\n";
echo "- SIMPLE_VALUE should remain unquoted\n";
echo "- SPACED_VALUE should remain quoted (has spaces)\n";
echo "- DOLLAR_VALUE should remain quoted (has \$ variable)\n\n";
echo "π Run: php artisan env:sync --path=.env.example --auto-sync\n";
echo "β
All quoted values should preserve their quotes!\n";
echo "β
VITE_APP_NAME=\"\${APP_NAME}\" should NOT become VITE_APP_NAME=\${APP_NAME}\n";