-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_remove_simple.php
More file actions
50 lines (39 loc) · 1.57 KB
/
test_remove_simple.php
File metadata and controls
50 lines (39 loc) · 1.57 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
45
46
47
48
49
50
<?php
// Create test files using native PHP
echo "Creating test files...\n";
// Create source file (.env) with extra keys
$sourceContent = "APP_NAME=TestApp
APP_ENV=local
APP_KEY=base64:test123
APP_DEBUG=true
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
EXTRA_KEY_1=value1
EXTRA_KEY_2=value2
MAIL_MAILER=smtp";
file_put_contents('.env', $sourceContent);
// Create target file (.env.example) with fewer keys
$targetContent = "APP_NAME=
APP_ENV=
APP_KEY=
APP_DEBUG=
DB_CONNECTION=
DB_HOST=";
file_put_contents('.env.example', $targetContent);
echo "Source file (.env) created with " . count(explode("\n", trim($sourceContent))) . " keys\n";
echo "Target file (.env.example) created with " . count(explode("\n", trim($targetContent))) . " keys\n";
echo "\nSource file contents:\n";
echo file_get_contents('.env');
echo "\nTarget file contents:\n";
echo file_get_contents('.env.example');
echo "\n" . str_repeat("=", 50) . "\n";
echo "TEST 1: Interactive remove (should show confirmation prompts)\n";
echo "Run: php artisan env:sync --path=.env.example --remove\n";
echo "Expected: Should ask for confirmation to remove EXTRA_KEY_1, EXTRA_KEY_2, MAIL_MAILER\n";
echo "\n" . str_repeat("=", 50) . "\n";
echo "TEST 2: Force remove with version control check\n";
echo "Run: php artisan env:sync --path=.env.example --remove --force\n";
echo "Expected: Should check if .env is version controlled and act accordingly\n";
echo "\n" . str_repeat("=", 50) . "\n";
echo "Files created successfully. You can now test the --remove functionality.\n";
echo "Remember to backup your original .env file if needed!\n";