set('admin_access.secrets_key', 'base64:'.base64_encode(random_bytes(32))); withStripeSecret(); Http::preventStrayRequests(); }); it('produces a result at all when the button is pressed', function () { Http::fake(['api.stripe.com/v1/account' => Http::response([ 'id' => 'acct_1', 'settings' => ['dashboard' => ['display_name' => 'CluPilot']], ])]); $page = Livewire::actingAs(operator('Owner'), 'operator') ->test(Integrations::class) ->set('confirmablePassword', 'password') ->call('confirmPassword') ->call('test', 'stripe.secret'); // Erst: kommt überhaupt ein Ergebnis an? Wenn ja, ist es keine kaputte // Prüfung, sondern eine Anzeige, die niemand findet. expect($page->get('check'))->not->toBeNull(); }); it('does not fall over when the DNS token is the one tested', function () { // Der Ergebnisblock las `$check['account']`, `$check['live']`, // `$check['webhooks']` — alles nur bei Stripe vorhanden. Ein // DnsTokenCheck-Ergebnis hat davon nichts, und `writable` ist obendrein // ein ERFOLG, laeuft also in genau diesen Zweig. Settings::set('provisioning.dns_zone', 'probe.example'); Http::fake([ 'api.hetzner.cloud/v1/zones' => Http::response(['zones' => [['id' => 42, 'name' => 'probe.example']]]), 'api.hetzner.cloud/v1/zones/probe.example/rrsets' => Http::response(['rrset' => ['id' => 'x/TXT']], 201), 'api.hetzner.cloud/v1/zones/probe.example/rrsets/*' => Http::response([], 201), ]); Livewire::actingAs(operator('Owner'), 'operator') ->test(Integrations::class) ->set('confirmablePassword', 'password') ->call('confirmPassword') ->set('entered.dns_token', 'irgendein-token') ->call('test', 'dns.token') ->assertOk() ->assertSee(__('secrets.check_writable')); }); it('shows the result beside the key it was run for, not at the end of the page', function () { // Der eigentliche Fund: das Ergebnis stand ganz unten, hinter allen // Karten und hinter dem Speichern-Knopf. Der Knopf sitzt oben in der // Stripe-Karte — wer ihn drückt, sieht die Antwort nicht, weil sie // ausserhalb des Bildschirms erscheint. Für den Betreiber ist das // ununterscheidbar von „der Knopf tut nichts". $markup = file_get_contents(base_path('resources/views/components/admin/secret-field.blade.php')); expect($markup)->toContain('$entry[\'check\']'); });