Bug 5339: Unit tests for invoices related subroutines