diff --git a/t/Feature/Resource/ModifierTest.php b/t/Feature/Resource/ModifierTest.php index e9667df..48eaa46 100644 --- a/t/Feature/Resource/ModifierTest.php +++ b/t/Feature/Resource/ModifierTest.php @@ -25,6 +25,11 @@ public function testDefaultIndex() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -34,7 +39,9 @@ public function testDefaultIndex() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifiers = $modifier_fabricator->create(10); @@ -60,6 +67,11 @@ public function testDefaultShow() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -69,7 +81,9 @@ public function testDefaultShow() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); @@ -178,6 +192,11 @@ public function testDefaultDelete() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -187,7 +206,9 @@ public function testDefaultDelete() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); @@ -214,6 +235,11 @@ public function testDefaultRestore() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -223,7 +249,9 @@ public function testDefaultRestore() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); model(ModifierModel::class)->delete($modifier->id); @@ -248,6 +276,11 @@ public function testDefaultForceDelete() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -257,7 +290,9 @@ public function testDefaultForceDelete() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); model(ModifierModel::class)->delete($modifier->id); @@ -296,6 +331,11 @@ public function testQueriedIndex() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -305,7 +345,9 @@ public function testQueriedIndex() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifiers = $modifier_fabricator->create(10); @@ -335,6 +377,11 @@ public function testMissingShow() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -344,7 +391,9 @@ public function testMissingShow() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); $modifier->id = $modifier->id + 1; @@ -363,6 +412,11 @@ public function testInvalidCreate() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -373,6 +427,8 @@ public function testInvalidCreate() $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id, "name" => "@only alphanumeric characters only" ]); $modifier = $modifier_fabricator->make(); @@ -401,6 +457,11 @@ public function testPartiallyUnownedCreate() "user_id" => $another_user->id ]); $currencyB = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currencyA->id @@ -413,7 +474,9 @@ public function testPartiallyUnownedCreate() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->make(); @@ -440,12 +503,19 @@ public function testInvalidUpdate() $account_fabricator->setOverrides([ "currency_id" => $currency->id ]); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $debit_account = $account_fabricator->create(); $credit_account = $account_fabricator->create(); $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); $modifier_fabricator->setOverrides([ @@ -473,6 +543,11 @@ public function testUnownedDelete() "user_id" => $another_user->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -482,7 +557,9 @@ public function testUnownedDelete() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); @@ -518,6 +595,11 @@ public function testDoubleDelete() "user_id" => $another_user->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -527,7 +609,9 @@ public function testDoubleDelete() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); model(ModifierModel::class)->delete($modifier->id); @@ -564,6 +648,11 @@ public function testDoubleRestore() "user_id" => $another_user->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -573,7 +662,9 @@ public function testDoubleRestore() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); @@ -604,6 +695,11 @@ public function testImmediateForceDelete() "user_id" => $authenticated_info->getUser()->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -613,7 +709,9 @@ public function testImmediateForceDelete() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); @@ -634,6 +732,11 @@ public function testDoubleForceDelete() "user_id" => $another_user->id ]); $currency = $currency_fabricator->create(); + $cash_flow_category_fabricator = new Fabricator(CashFlowCategoryModel::class); + $cash_flow_category_fabricator->setOverrides([ + "user_id" => $authenticated_info->getUser()->id + ]); + $cash_flow_category = $cash_flow_category_fabricator->create(); $account_fabricator = new Fabricator(AccountModel::class); $account_fabricator->setOverrides([ "currency_id" => $currency->id @@ -643,7 +746,9 @@ public function testDoubleForceDelete() $modifier_fabricator = new Fabricator(ModifierModel::class); $modifier_fabricator->setOverrides([ "debit_account_id" => $debit_account->id, - "credit_account_id" => $credit_account->id + "credit_account_id" => $credit_account->id, + "debit_cash_flow_category_id" => $cash_flow_category->id, + "credit_cash_flow_category_id" => $cash_flow_category->id ]); $modifier = $modifier_fabricator->create(); model(ModifierModel::class)->delete($modifier->id, true);