diff --git a/resources/lang/de_DE/validation.php b/resources/lang/de_DE/validation.php index 1579fce1db..d30156cb75 100644 --- a/resources/lang/de_DE/validation.php +++ b/resources/lang/de_DE/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Dieser Wert ist für dieses Feld ungültig.', 'at_least_one_transaction' => 'Sie brauchen mindestens eine Transaktion.', 'at_least_one_repetition' => 'Mindestens eine Wiederholung erforderlich.', - 'require_repeat_until' => 'Erfordert entweder eine Anzahl von Wiederholungen oder ein Enddatum (repeats_until). Nicht beides.', + 'require_repeat_until' => 'Erfordert entweder eine Anzahl von Wiederholungen oder ein Enddatum (repeat_until). Nicht beides.', 'require_currency_info' => 'Der Inhalt dieses Feldes ist ohne Währungsinformationen ungültig.', 'equal_description' => 'Die Transaktionsbeschreibung darf nicht der globalen Beschreibung entsprechen.', 'file_invalid_mime' => 'Die Datei „:name” ist vom Typ „:mime”, welcher nicht zum Hochladen zugelassen ist.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'Der Wert von :attribute ist unbekannt.', 'accepted' => ':attribute muss akzeptiert werden.', 'bic' => 'Dies ist kein gültiger BIC.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Regel muss mindestens einen Auslöser enthalten', + 'at_least_one_action' => 'Regel muss mindestens eine Aktion enthalten', 'base64' => 'Dies sind keine gültigen base64-kodierten Daten.', 'model_id_invalid' => 'Die angegebene ID scheint für dieses Modell ungültig zu sein.', 'more' => ':attribute muss größer als Null sein.', @@ -91,6 +91,9 @@ return [ 'min.array' => ':attribute muss mindestens :min Elemente enthalten.', 'not_in' => ':attribute ist ungültig.', 'numeric' => ':attribute muss eine Zahl sein.', + 'numeric_native' => 'Die native Betrag muss eine Zahl sein.', + 'numeric_destination' => 'Der Zielbeitrag muss eine Zahl sein.', + 'numeric_source' => 'Der Quellbetrag muss eine Zahl sein.', 'regex' => 'Das Format von :attribute ist ungültig.', 'required' => ':attribute Feld muss ausgefüllt sein.', 'required_if' => ':attribute Feld ist notwendig, wenn :other :value entspricht.', diff --git a/resources/lang/es_ES/validation.php b/resources/lang/es_ES/validation.php index 3a4f8bf42c..106e5f668c 100644 --- a/resources/lang/es_ES/validation.php +++ b/resources/lang/es_ES/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Este valor no es válido para este campo.', 'at_least_one_transaction' => 'Se necesita al menos una transacción.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'El contenido de este campo no es válido sin la información montearia.', 'equal_description' => 'Transaction description should not equal global description.', 'file_invalid_mime' => 'El archivo ":name" es de tipo ":mime", el cual no se acepta.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => 'El :attribute debe ser aceptado.', 'bic' => 'Esto no es un BIC válido.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'This is not valid base64 encoded data.', 'model_id_invalid' => 'The given ID seems invalid for this model.', 'more' => ':attribute debe ser mayor que cero.', @@ -91,6 +91,9 @@ return [ 'min.array' => 'El campo :attribute debe tener al menos :min elementos.', 'not_in' => 'El campo :attribute seleccionado es incorrecto.', 'numeric' => 'El campo :attribute debe ser un número.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => 'El formato del campo :attribute no es válido.', 'required' => 'El campo :attribute es obligatorio.', 'required_if' => 'El campo :attribute es obligatorio cuando el campo :other es :value.', diff --git a/resources/lang/fr_FR/validation.php b/resources/lang/fr_FR/validation.php index c6b8b5620a..e5277aa087 100644 --- a/resources/lang/fr_FR/validation.php +++ b/resources/lang/fr_FR/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Cette valeur n\'est pas valide pour ce champ.', 'at_least_one_transaction' => 'Besoin d\'au moins une transaction.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'Le contenu de ce champ n\'est pas valide sans informations sur la devise.', 'equal_description' => 'La description de la transaction ne doit pas être égale à la description globale.', 'file_invalid_mime' => 'Le fichier ":name" est du type ":mime" ce qui n\'est pas accepté pour un nouvel envoi.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => 'Le champ :attribute doit être accepté.', 'bic' => 'Ce n’est pas un code BIC valide.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'This is not valid base64 encoded data.', 'model_id_invalid' => 'The given ID seems invalid for this model.', 'more' => ':attribute doit être supérieur à zéro.', @@ -91,6 +91,9 @@ return [ 'min.array' => 'Le tableau :attribute doit avoir au moins :min éléments.', 'not_in' => 'Le champ :attribute sélectionné n\'est pas valide.', 'numeric' => 'Le champ :attribute doit contenir un nombre.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => 'Le format du champ :attribute est invalide.', 'required' => 'Le champ :attribute est obligatoire.', 'required_if' => 'Le champ :attribute est obligatoire quand la valeur de :other est :value.', diff --git a/resources/lang/id_ID/validation.php b/resources/lang/id_ID/validation.php index e69a758174..3175395fc5 100644 --- a/resources/lang/id_ID/validation.php +++ b/resources/lang/id_ID/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'This value is invalid for this field.', 'at_least_one_transaction' => 'Need at least one transaction.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'The content of this field is invalid without currency information.', 'equal_description' => 'Transaction description should not equal global description.', 'file_invalid_mime' => 'File ":name" adalah tipe ":mime" yang tidak diterima sebagai upload baru.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => ':attribute harus diterima.', 'bic' => 'Ini bukan BIC yang valid.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'This is not valid base64 encoded data.', 'model_id_invalid' => 'The given ID seems invalid for this model.', 'more' => ':attribute harus lebih besar dari nol.', @@ -91,6 +91,9 @@ return [ 'min.array' => ':attribute harus minimal item :min.', 'not_in' => ':attribute yang dipilih tidak valid.', 'numeric' => ':attribute harus angka.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => 'Format :attribute tidak valid.', 'required' => 'Bidang :attribute diperlukan.', 'required_if' => 'Bidang :attribute diperlukan ketika :other adalah :value.', diff --git a/resources/lang/it_IT/validation.php b/resources/lang/it_IT/validation.php index c39bf3f0da..c5d8699a6b 100644 --- a/resources/lang/it_IT/validation.php +++ b/resources/lang/it_IT/validation.php @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'Il valore di :attribute è sconosciuto.', 'accepted' => 'L\' :attribute deve essere accettato.', 'bic' => 'Questo non è un BIC valido.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Una regola deve avere almeno un trigger.', + 'at_least_one_action' => 'Una regola deve avere almeno una azione.', 'base64' => 'Questi non sono dati codificati in base64 validi.', 'model_id_invalid' => 'L\'ID fornito sembra non essere valido per questo modello.', 'more' => ':attribute deve essere maggiore di zero.', @@ -91,6 +91,9 @@ return [ 'min.array' => ':attribute deve avere almeno :min voci.', 'not_in' => ':attribute selezionato è invalido.', 'numeric' => ':attribute deve essere un numero.', + 'numeric_native' => 'L\'importo nativo deve essere un numero.', + 'numeric_destination' => 'L\'importo di destinazione deve essere un numero.', + 'numeric_source' => 'L\'importo sorgente deve essere un numero.', 'regex' => ':attribute formato non valido', 'required' => 'Il campo :attribute è obbligatorio.', 'required_if' => 'Il campo :attribute è obbligatorio quando :other è :value.', diff --git a/resources/lang/nl_NL/validation.php b/resources/lang/nl_NL/validation.php index 465daadb5e..add99c5012 100644 --- a/resources/lang/nl_NL/validation.php +++ b/resources/lang/nl_NL/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Deze waarde is ongeldig voor dit veld.', 'at_least_one_transaction' => 'Er is op zijn minst één transactie nodig.', 'at_least_one_repetition' => 'Er is op zijn minst één herhaling nodig.', - 'require_repeat_until' => 'Je moet een aantal herhalingen opgeven, of een einddatum (repeats_until). Niet beide.', + 'require_repeat_until' => 'Je moet een aantal herhalingen opgeven, of een einddatum (repeat_until). Niet beide.', 'require_currency_info' => 'De inhoud van dit veld is ongeldig zonder valutagegevens.', 'equal_description' => 'Transactiebeschrijving mag niet gelijk zijn aan globale beschrijving.', 'file_invalid_mime' => 'Bestand ":name" is van het type ":mime", en die kan je niet uploaden.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'De waarde van :attribute is onbekend.', 'accepted' => ':attribute moet geaccepteerd zijn.', 'bic' => 'Dit is geen geldige BIC.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'De regel moet minstens één trigger hebben.', + 'at_least_one_action' => 'De regel moet minstens één actie hebben.', 'base64' => 'Dit is geen geldige base64 gecodeerde data.', 'model_id_invalid' => 'Dit ID past niet bij dit object.', 'more' => ':attribute moet groter zijn dan nul.', @@ -91,6 +91,9 @@ return [ 'min.array' => ':attribute moet minimaal :min items bevatten.', 'not_in' => 'Het formaat van :attribute is ongeldig.', 'numeric' => ':attribute moet een nummer zijn.', + 'numeric_native' => 'Het originele bedrag moet een getal zijn.', + 'numeric_destination' => 'Het doelbedrag moet een getal zijn.', + 'numeric_source' => 'Het bronbedrag moet een getal zijn.', 'regex' => ':attribute formaat is ongeldig.', 'required' => ':attribute is verplicht.', 'required_if' => ':attribute is verplicht indien :other gelijk is aan :value.', diff --git a/resources/lang/pl_PL/validation.php b/resources/lang/pl_PL/validation.php index 40ea0ea2d8..2cd06c8b85 100644 --- a/resources/lang/pl_PL/validation.php +++ b/resources/lang/pl_PL/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Ta wartość jest nieprawidłowa dla tego pola.', 'at_least_one_transaction' => 'Wymaga co najmniej jednej transakcji.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'Treść tego pola jest nieprawidłowa bez informacji o walucie.', 'equal_description' => 'Opis transakcji nie powinien być równy globalnemu opisowi.', 'file_invalid_mime' => 'Plik ":name" jest typu ":mime", który nie jest akceptowany jako nowy plik do przekazania.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => ':attribute musi zostać zaakceptowany.', 'bic' => 'To nie jest prawidłowy BIC.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'This is not valid base64 encoded data.', 'model_id_invalid' => 'The given ID seems invalid for this model.', 'more' => ':attribute musi być większy od zera.', @@ -91,6 +91,9 @@ return [ 'min.array' => ':attribute musi zawierać przynajmniej :min elementów.', 'not_in' => 'Wybrany :attribute jest nieprawidłowy.', 'numeric' => ':attribute musi byc liczbą.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => 'Format :attribute jest nieprawidłowy.', 'required' => 'Pole :attribute jest wymagane.', 'required_if' => 'Pole :attribute jest wymagane gdy :other jest :value.', diff --git a/resources/lang/pt_BR/validation.php b/resources/lang/pt_BR/validation.php index 48f3428533..eec02240af 100644 --- a/resources/lang/pt_BR/validation.php +++ b/resources/lang/pt_BR/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Esse valor é inválido para este campo.', 'at_least_one_transaction' => 'Precisa de ao menos uma transação.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'O conteúdo deste campo é inválido sem informações de moeda.', 'equal_description' => 'A descrição da transação não pode ser igual à descrição global.', 'file_invalid_mime' => 'Arquivo ":name" é do tipo ":mime" que não é aceito como um novo upload.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => 'O campo :attribute deve ser aceito.', 'bic' => 'Este não é um BIC válido.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'This is not valid base64 encoded data.', 'model_id_invalid' => 'The given ID seems invalid for this model.', 'more' => ':attribute deve ser maior que zero.', @@ -91,6 +91,9 @@ return [ 'min.array' => 'O campo :attribute deve ter no mínimo :min itens.', 'not_in' => 'O campo :attribute contém um valor inválido.', 'numeric' => 'O campo :attribute deverá conter um valor numérico.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => 'O formato do valor para o campo :attribute é inválido.', 'required' => 'O campo :attribute é obrigatório.', 'required_if' => 'O campo :attribute é obrigatório quando o valor do campo :other é igual a :value.', diff --git a/resources/lang/ru_RU/validation.php b/resources/lang/ru_RU/validation.php index cf9e7ffbc7..e3fd87a974 100644 --- a/resources/lang/ru_RU/validation.php +++ b/resources/lang/ru_RU/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Данное значение недопустимо для этого поля.', 'at_least_one_transaction' => 'Необходима как минимум одна транзакция.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'Содержимое этого поля недействительно без информации о валюте.', 'equal_description' => 'Описание транзакции не должно совпадать с глобальным описанием.', 'file_invalid_mime' => 'Файл ":name" имеет тип ":mime". Загрузка файлов такого типа невозможна.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => 'Необходимо принять :attribute.', 'bic' => 'Это некорректный BIC.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'This is not valid base64 encoded data.', 'model_id_invalid' => 'The given ID seems invalid for this model.', 'more' => ':attribute должен быть больше нуля.', @@ -91,6 +91,9 @@ return [ 'min.array' => 'Значение :attribute должно содержать не меньше :min элементов.', 'not_in' => 'Выбранный :attribute не верный.', 'numeric' => ':attribute должен быть числом.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => 'Формат :attribute некорректен.', 'required' => 'Поле :attribute является обязательным.', 'required_if' => 'Значение :attribute является обязательным, когда :other равное :value.', diff --git a/resources/lang/tr_TR/validation.php b/resources/lang/tr_TR/validation.php index 88ca42b1e9..9fa4b2ad3b 100644 --- a/resources/lang/tr_TR/validation.php +++ b/resources/lang/tr_TR/validation.php @@ -38,7 +38,7 @@ return [ 'belongs_user' => 'Bu değer bu alan için geçerli değil.', 'at_least_one_transaction' => 'En az bir işlem gerekir.', 'at_least_one_repetition' => 'Need at least one repetition.', - 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeats_until). Not both.', + 'require_repeat_until' => 'Require either a number of repetitions, or an end date (repeat_until). Not both.', 'require_currency_info' => 'Bu alanın içeriği para birimi bilgileri geçersiz.', 'equal_description' => 'İşlem açıklaması genel açıklama eşit değildir.', 'file_invalid_mime' => '":name" dosyası ":mime" türünde olup yeni bir yükleme olarak kabul edilemez.', @@ -46,8 +46,8 @@ return [ 'belongs_to_user' => 'The value of :attribute is unknown.', 'accepted' => ':attribute kabul edilmek zorunda.', 'bic' => 'Bu BIC geçerli değilrdir.', - 'at_least_one_trigger' => 'Rule must have at least one trigger', - 'at_least_one_action' => 'Rule must have at least one action', + 'at_least_one_trigger' => 'Rule must have at least one trigger.', + 'at_least_one_action' => 'Rule must have at least one action.', 'base64' => 'Bu geçerli Base64 olarak kodlanmış veri değildir.', 'model_id_invalid' => 'Verilen kimlik bu model için geçersiz görünüyor.', 'more' => ':attribute sıfırdan büyük olmak zorundadır.', @@ -91,6 +91,9 @@ return [ 'min.array' => ':attribute en az :min öğe içermelidir.', 'not_in' => 'Seçili :attribute geçersiz.', 'numeric' => ':attribute sayı olmalıdır.', + 'numeric_native' => 'The native amount must be a number.', + 'numeric_destination' => 'The destination amount must be a number.', + 'numeric_source' => 'The source amount must be a number.', 'regex' => ':attribute biçimi geçersiz.', 'required' => ':attribute alanı gereklidir.', 'required_if' => ':other :value iken :attribute alanı gereklidir.', diff --git a/tests/Feature/Controllers/Import/IndexControllerTest.php b/tests/Feature/Controllers/Import/IndexControllerTest.php index 76026e0227..10b8e6a942 100644 --- a/tests/Feature/Controllers/Import/IndexControllerTest.php +++ b/tests/Feature/Controllers/Import/IndexControllerTest.php @@ -225,7 +225,7 @@ class IndexControllerTest extends TestCase $this->be($this->user()); $response = $this->get(route('import.job.download', [$job->key])); $response->assertStatus(200); - $response->assertExactJson(['column-mapping-config' => [], 'delimiter' => ',', 'hi' => 'there', 1 => true]); + $response->assertExactJson(['column-mapping-config' => ['a', 'b', 'c'], 'delimiter' => ',', 'hi' => 'there', 1 => true]); } /** diff --git a/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php b/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php index d101303717..60675e0aa5 100644 --- a/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php +++ b/tests/Unit/Support/Import/Routine/File/ImportableConverterTest.php @@ -342,8 +342,8 @@ class ImportableConverterTest extends TestCase $this->assertEquals($importable->billName, $result[0]['bill_name']); $this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']); // since amount is positive, $asset recieves the money - $this->assertEquals($other->id, $result[0]['transactions'][0]['source_id']); - $this->assertEquals($asset->id, $result[0]['transactions'][0]['destination_id']); + $this->assertEquals($asset->id, $result[0]['transactions'][0]['source_id']); + $this->assertEquals($other->id, $result[0]['transactions'][0]['destination_id']); } /** @@ -412,8 +412,8 @@ class ImportableConverterTest extends TestCase $this->assertEquals($importable->billName, $result[0]['bill_name']); $this->assertEquals($usd->id, $result[0]['transactions'][0]['currency_id']); // since amount is negative, $asset sends the money - $this->assertEquals($asset->id, $result[0]['transactions'][0]['source_id']); - $this->assertEquals($other->id, $result[0]['transactions'][0]['destination_id']); + $this->assertEquals($other->id, $result[0]['transactions'][0]['source_id']); + $this->assertEquals($asset->id, $result[0]['transactions'][0]['destination_id']); } /** diff --git a/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php b/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php index 989660cfba..fe532b16b0 100644 --- a/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php +++ b/tests/Unit/TransactionRules/Triggers/HasAnyBudgetTest.php @@ -37,7 +37,14 @@ class HasAnyBudgetTest extends TestCase */ public function testTriggered(): void { - $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); + $loop = 0; + do { + /** @var TransactionJournal $journal */ + $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); + $count = $journal->transactions()->count(); + $loop++; + } while ($count !== 0 && $loop < 30); + $budget = $journal->user->budgets()->first(); $journal->budgets()->detach(); $journal->budgets()->save($budget); @@ -46,6 +53,7 @@ class HasAnyBudgetTest extends TestCase $trigger = HasAnyBudget::makeFromStrings('', false); $result = $trigger->triggered($journal); $this->assertTrue($result); + } /** @@ -53,11 +61,13 @@ class HasAnyBudgetTest extends TestCase */ public function testTriggeredNot(): void { + $loop = 0; do { /** @var TransactionJournal $journal */ $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); $count = $journal->transactions()->count(); - } while ($count !== 0); + $loop++; + } while ($count !== 0 && $loop < 30); $journal->budgets()->detach(); $this->assertEquals(0, $journal->budgets()->count()); @@ -78,7 +88,14 @@ class HasAnyBudgetTest extends TestCase */ public function testTriggeredTransactions(): void { - $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); + $loop = 0; + do { + /** @var TransactionJournal $journal */ + $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); + $count = $journal->transactions()->count(); + $loop++; + } while ($count !== 0 && $loop < 30); + $budget = $journal->user->budgets()->first(); $journal->budgets()->detach(); $this->assertEquals(0, $journal->budgets()->count());