28 lines
1.1 KiB
PHP
28 lines
1.1 KiB
PHP
<?php // tests/Feature/NextcloudOccTest.php
|
|
|
|
use App\Support\NextcloudOcc;
|
|
|
|
it('haelt den Wert aus dem occ-Aufruf heraus', function () {
|
|
$befehl = NextcloudOcc::commandExpandingEnv(
|
|
'config:system:set mail_smtppassword --value="$CLUPILOT_SMTP_PW"',
|
|
['CLUPILOT_SMTP_PW' => 'geheim'],
|
|
);
|
|
|
|
// Der Wert steht als Zuweisung VOR dem docker-Aufruf (die aeussere Shell
|
|
// reicht ihn durch), aber der occ-Aufruf selbst (ab `sh -c`) traegt nur
|
|
// den VARIABLENNAMEN. Damit sitzt das Geheimnis nicht im Argv des
|
|
// Containers.
|
|
expect($befehl)->toContain("CLUPILOT_SMTP_PW='geheim'")
|
|
->and($befehl)->toContain('-e CLUPILOT_SMTP_PW')
|
|
->and($befehl)->toContain('sh -c')
|
|
// Entscheidend: ab `sh -c` (der Innenteil des Containers) steht nur der Name.
|
|
->and(substr($befehl, strpos($befehl, 'sh -c')))->not->toContain('geheim');
|
|
});
|
|
|
|
it('haelt sich an dasselbe Verzeichnis und denselben Benutzer wie command()', function () {
|
|
$befehl = NextcloudOcc::commandExpandingEnv('status', []);
|
|
|
|
expect($befehl)->toStartWith('cd '.NextcloudOcc::DIRECTORY)
|
|
->and($befehl)->toContain('-u '.NextcloudOcc::USER);
|
|
});
|