Fehler in Abrechnungsende behoben
This commit is contained in:
@@ -183,12 +183,47 @@ class InvoicePurposeTest extends TestCase
|
||||
|
||||
public function test_travel_costs_without_travellers_record_only_the_reason(): void
|
||||
{
|
||||
// Ohne Login steht im Formular niemand drin -- das darf den Beleg nicht aufhalten.
|
||||
// Der Command selbst verlangt keine Personen: Abrechnungskorrekturen laufen ohne sie durch. Die
|
||||
// Pflicht beim Einreichen prüft der SaveInvoiceController -- siehe die Tests unten.
|
||||
$invoice = $this->submit(InvoiceType::INVOICE_TYPE_TRAVELLING, travelReason: 'Landeslager');
|
||||
|
||||
$this->assertSame('Landeslager', $invoice->purpose);
|
||||
}
|
||||
|
||||
/**
|
||||
* Eine Fahrtkostenabrechnung über das Formular, als Kilometerpauschale ohne Beleg.
|
||||
*/
|
||||
private function postTravelExpense(CostUnit $costUnit, ?string $travellers): \Illuminate\Testing\TestResponse
|
||||
{
|
||||
return $this->postJson('/api/v1/invoice/new/' . $costUnit->id . '/' . InvoiceType::INVOICE_TYPE_TRAVELLING, [
|
||||
'name' => 'Max Mustermann',
|
||||
'amount' => '100',
|
||||
'otherText' => 'Halle – Leipzig',
|
||||
'decision' => 'payout',
|
||||
'travelReason' => 'Landeslager',
|
||||
'travellers' => $travellers,
|
||||
]);
|
||||
}
|
||||
|
||||
public function test_submitting_travel_costs_requires_who_travelled(): void
|
||||
{
|
||||
$costUnit = $this->makeCostUnit();
|
||||
|
||||
foreach ([null, '', ' '] as $travellers) {
|
||||
$this->postTravelExpense($costUnit, $travellers)
|
||||
->assertJson(['status' => 'error', 'message' => 'Bitte gib an, welche Personen gereist sind.']);
|
||||
}
|
||||
|
||||
$this->assertSame(0, Invoice::count());
|
||||
}
|
||||
|
||||
public function test_submitting_travel_costs_with_travellers_is_accepted(): void
|
||||
{
|
||||
$this->postTravelExpense($this->makeCostUnit(), 'Mika und Kim')->assertJson(['status' => 'success']);
|
||||
|
||||
$this->assertSame('Landeslager — Mika und Kim', Invoice::sole()->purpose);
|
||||
}
|
||||
|
||||
public function test_a_refund_records_no_purpose(): void
|
||||
{
|
||||
// Beitragserstattungen entstehen ohne Freitext. `null` statt Leerstring: So greift für sie
|
||||
|
||||
Reference in New Issue
Block a user