Skip to content

Commit 787e227

Browse files
igorgudeljclaude
andcommitted
Add test for NSIS delete app data env variable passthrough
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c969384 commit 787e227

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?php
2+
3+
use Illuminate\Support\Facades\Config;
4+
use Native\Desktop\Drivers\Electron\Commands\BuildCommand;
5+
6+
it('passes NSIS delete app data flag as true when config is enabled', function () {
7+
Config::set('nativephp.nsis.delete_app_data_on_uninstall', true);
8+
9+
$command = app(BuildCommand::class);
10+
$envVars = (new ReflectionMethod($command, 'getEnvironmentVariables'))->invoke($command);
11+
12+
expect($envVars['NATIVEPHP_NSIS_DELETE_APP_DATA'])->toBe('true');
13+
});
14+
15+
it('passes NSIS delete app data flag as false when config is disabled', function () {
16+
Config::set('nativephp.nsis.delete_app_data_on_uninstall', false);
17+
18+
$command = app(BuildCommand::class);
19+
$envVars = (new ReflectionMethod($command, 'getEnvironmentVariables'))->invoke($command);
20+
21+
expect($envVars['NATIVEPHP_NSIS_DELETE_APP_DATA'])->toBe('false');
22+
});
23+
24+
it('defaults NSIS delete app data flag to false when config is not set', function () {
25+
Config::set('nativephp.nsis.delete_app_data_on_uninstall', null);
26+
27+
$command = app(BuildCommand::class);
28+
$envVars = (new ReflectionMethod($command, 'getEnvironmentVariables'))->invoke($command);
29+
30+
expect($envVars['NATIVEPHP_NSIS_DELETE_APP_DATA'])->toBe('false');
31+
});

0 commit comments

Comments
 (0)