27 lines
1.1 KiB
PHP
27 lines
1.1 KiB
PHP
<?php // tests/Feature/NextcloudOccTest.php
|
|
|
|
use App\Support\NextcloudOcc;
|
|
|
|
it('setzt den Wert erst IM Container ein, nicht in der VM', function () {
|
|
$befehl = NextcloudOcc::commandExpandingEnv(
|
|
'config:system:set mail_smtppassword --value="$CLUPILOT_SMTP_PW"',
|
|
['CLUPILOT_SMTP_PW' => 'geheim'],
|
|
);
|
|
|
|
// Das Geheimnis steht als Zuweisung da (die aeussere Shell reicht es
|
|
// durch), aber der occ-Aufruf traegt nur den VARIABLENNAMEN — eingesetzt
|
|
// wird er von der sh INNERHALB des Containers.
|
|
expect($befehl)->toContain("CLUPILOT_SMTP_PW='geheim'")
|
|
->and($befehl)->toContain('-e CLUPILOT_SMTP_PW')
|
|
->and($befehl)->toContain('sh -c')
|
|
// Entscheidend: hinter `php occ` steht der Name, nicht der Wert.
|
|
->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);
|
|
});
|