Skip to content

Commit

Permalink
test(feature): add cash flow category for testing modifier
Browse files Browse the repository at this point in the history
  • Loading branch information
KennethTrecy committed May 22, 2024
1 parent c91e34f commit 6aea7e5
Showing 1 changed file with 119 additions and 14 deletions.
133 changes: 119 additions & 14 deletions t/Feature/Resource/ModifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);

Expand All @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -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
Expand All @@ -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();

Expand All @@ -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
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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);

Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -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
Expand All @@ -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();
Expand Down Expand Up @@ -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
Expand All @@ -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();

Expand All @@ -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([
Expand Down Expand Up @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -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
Expand All @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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();

Expand Down Expand Up @@ -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
Expand All @@ -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();

Expand All @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 6aea7e5

Please sign in to comment.