send($payment, null)); } public function testSendsReceiptToStudent(): void { Functions\expect('wp_mail') ->once() ->with('a@b.test', Mockery::type('string'), Mockery::type('string')) ->andReturn(true); $student = Mockery::mock(\WP_User::class); $student->user_email = 'a@b.test'; $payment = new Payment(5, 3, Payment::REG_LESSON, 12, 35.00, receiptNumber: 'USC-1'); self::assertTrue((new ReceiptMailer())->send($payment, $student)); } public function testReceiptBreaksOutHstWhenTaxed(): void { Functions\expect('wp_mail') ->once() ->with( 'a@b.test', Mockery::type('string'), Mockery::on(static fn (string $body): bool => str_contains($body, 'HST') && str_contains($body, '113.00')) ) ->andReturn(true); $student = Mockery::mock(\WP_User::class); $student->user_email = 'a@b.test'; $payment = new Payment(5, 3, Payment::REG_LESSON, 12, 100.00, taxRate: 13.0, taxAmount: 13.00, receiptNumber: 'USC-1'); self::assertTrue((new ReceiptMailer())->send($payment, $student)); } }