'CluPilot Cloud e.U.', 'address' => 'Dreherstraße 66/1/8', 'postcode' => '1110', 'city' => 'Wien', 'register_number' => 'FN 123456a', 'register_court' => 'Handelsgericht Wien', 'vat_id' => 'ATU00000000', ]; it('labels the issuer VAT number, and only that one', function () use ($issuer) { $columns = InvoiceDocument::footerColumns($issuer, 'UID'); expect($columns[2])->toBe([ // Its neighbours stay as they are: a Firmenbuch number and a court name // announce themselves, an ATU string does not. 'FN 123456a', 'UID: ATU00000000', 'Handelsgericht Wien', ]); }); it('leaves out the line entirely when no VAT number is recorded', function () use ($issuer) { // A label with nothing after it is worse than the bare number was. The company // details are required before an invoice can be issued at all, so this is the // half-configured installation rather than a document anybody receives. $columns = InvoiceDocument::footerColumns(['vat_id' => ''] + $issuer, 'UID'); expect($columns[2])->toBe(['FN 123456a', 'Handelsgericht Wien']); }); it('drops empty details rather than leaving gaps where they would be', function () { $columns = InvoiceDocument::footerColumns(['name' => 'Nur ein Name']); expect($columns[0])->toBe(['Nur ein Name']) ->and($columns[1])->toBe([]) ->and($columns[3])->toBe([]); });