$base_level) { $output .= (string)ob_get_clean(); } return $output; } $base_level = ob_get_level(); ob_start(); try { $html = (new \email\templates\email_template_stripe_invoice( 4242, 'https://pay.example.com/invoice/abc', 'Anders And' ))->generate_html(); $leaked_output = cleanup_buffers_to($base_level); assert_true($leaked_output === '', 'Template generation must not leak buffered HTML output.'); // TRU-71: user-facing wording must not mention the payment processor // by name. The email body must describe the artefact in plain // language instead. assert_true( stripos($html, 'stripe') === false, 'Stripe-invoice email body must no longer expose the payment processor name "Stripe" to the customer.' ); assert_true( str_contains($html, 'betalingslink'), 'Stripe-invoice email body must describe the artefact as a betalingslink (payment link).' ); assert_true( str_contains($html, 'Kære Anders And'), 'Template must still greet the customer by name.' ); assert_true( str_contains($html, 'Betal faktura for ordre 4242'), 'Template must still expose a pay-now action link for the order.' ); } catch (\Throwable $exception) { $leaked_output = cleanup_buffers_to($base_level); fwrite(STDERR, $leaked_output); fwrite(STDERR, $exception->getMessage() . PHP_EOL); exit(1); } echo "\033[32m[PASS]\033[0m Stripe-invoice email template no longer mentions Stripe to the customer.\n"; exit(0); }