mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix test coverage.
This commit is contained in:
@@ -184,8 +184,9 @@ class AccountControllerTest extends TestCase
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
'errors' => [
|
||||
'cc_monthly_payment_date' => ['The cc monthly payment date field is required when account role is ccAsset.'],
|
||||
'cc_type' => ['The cc type field is required when account role is ccAsset.'],
|
||||
'credit_card_type' => ['The credit card type field is required when account role is ccAsset.'],
|
||||
'monthly_payment_date' => ['The monthly payment date field is required when account role is ccAsset.'],
|
||||
|
||||
],
|
||||
]
|
||||
);
|
||||
|
||||
@@ -72,7 +72,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
);
|
||||
|
||||
// call API
|
||||
$response = $this->delete('/api/v1/budget_limits/' . $budgetLimit->id);
|
||||
$response = $this->delete('/api/v1/budgets/limits/' . $budgetLimit->id);
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$params = [
|
||||
'budget_id' => $budget->id,
|
||||
];
|
||||
$response = $this->get('/api/v1/budget_limits?' . http_build_query($params));
|
||||
$response = $this->get('/api/v1/budgets/limits?' . http_build_query($params));
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -124,7 +124,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
'start' => '2018-01-01',
|
||||
'end' => '2018-01-31',
|
||||
];
|
||||
$uri = '/api/v1/budget_limits?' . http_build_query($params);
|
||||
$uri = '/api/v1/budgets/limits?' . http_build_query($params);
|
||||
$response = $this->get($uri);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -153,7 +153,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
'start' => '2018-01-01',
|
||||
'end' => '2018-01-31',
|
||||
];
|
||||
$response = $this->get('/api/v1/budget_limits?' . http_build_query($params));
|
||||
$response = $this->get('/api/v1/budgets/limits?' . http_build_query($params));
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -174,15 +174,15 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$budget = $this->user()->budgets()->first();
|
||||
$budgetLimit = BudgetLimit::create(
|
||||
[
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
]
|
||||
);
|
||||
|
||||
|
||||
$response = $this->get('/api/v1/budget_limits/' . $budgetLimit->id);
|
||||
$response = $this->get('/api/v1/budgets/limits/' . $budgetLimit->id);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -198,18 +198,18 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$budget = $this->user()->budgets()->first();
|
||||
$budgetLimit = BudgetLimit::create(
|
||||
[
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
]
|
||||
);
|
||||
$data
|
||||
= [
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
'budget_id' => $budget->id,
|
||||
'start' => '2018-01-01',
|
||||
'end' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
];
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
@@ -221,7 +221,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
// call API
|
||||
$response = $this->post('/api/v1/budget_limits', $data);
|
||||
$response = $this->post('/api/v1/budgets/limits', $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -236,10 +236,10 @@ class BudgetLimitControllerTest extends TestCase
|
||||
{
|
||||
$data
|
||||
= [
|
||||
'budget_id' => '1',
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
'budget_id' => '1',
|
||||
'start' => '2018-01-01',
|
||||
'end' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
];
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
@@ -250,7 +250,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
// call API
|
||||
$response = $this->post('/api/v1/budget_limits', $data);
|
||||
$response = $this->post('/api/v1/budgets/limits', $data);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('Unknown budget.');
|
||||
}
|
||||
@@ -266,18 +266,18 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$budget = $this->user()->budgets()->first();
|
||||
$budgetLimit = BudgetLimit::create(
|
||||
[
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 1,
|
||||
]
|
||||
);
|
||||
$data
|
||||
= [
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 2,
|
||||
'budget_id' => $budget->id,
|
||||
'start' => '2018-01-01',
|
||||
'end' => '2018-01-31',
|
||||
'amount' => 2,
|
||||
];
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
@@ -289,7 +289,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
// call API
|
||||
$response = $this->put('/api/v1/budget_limits/' . $budgetLimit->id, $data);
|
||||
$response = $this->put('/api/v1/budgets/limits/' . $budgetLimit->id, $data);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
|
||||
@@ -314,10 +314,10 @@ class BudgetLimitControllerTest extends TestCase
|
||||
);
|
||||
$data
|
||||
= [
|
||||
'budget_id' => $budget->id,
|
||||
'start_date' => '2018-01-01',
|
||||
'end_date' => '2018-01-31',
|
||||
'amount' => 2,
|
||||
'budget_id' => $budget->id,
|
||||
'start' => '2018-01-01',
|
||||
'end' => '2018-01-31',
|
||||
'amount' => 2,
|
||||
];
|
||||
// mock stuff:
|
||||
$repository = $this->mock(BudgetRepositoryInterface::class);
|
||||
@@ -328,7 +328,7 @@ class BudgetLimitControllerTest extends TestCase
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
// call API
|
||||
$response = $this->put('/api/v1/budget_limits/' . $budgetLimit->id, $data);
|
||||
$response = $this->put('/api/v1/budgets/limits/' . $budgetLimit->id, $data);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('Unknown budget.');
|
||||
}
|
||||
|
||||
@@ -120,7 +120,6 @@ class ConfigurationControllerTest extends TestCase
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
$data = [
|
||||
'name' => 'permission_update_check',
|
||||
'value' => 1,
|
||||
|
||||
];
|
||||
@@ -157,7 +156,7 @@ class ConfigurationControllerTest extends TestCase
|
||||
],
|
||||
];
|
||||
|
||||
$response = $this->post('/api/v1/configuration', $data);
|
||||
$response = $this->post('/api/v1/configuration/permission_update_check', $data);
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson($expected);
|
||||
}
|
||||
@@ -173,7 +172,6 @@ class ConfigurationControllerTest extends TestCase
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
|
||||
$data = [
|
||||
'name' => 'single_user_mode',
|
||||
'value' => 'true',
|
||||
|
||||
];
|
||||
@@ -210,7 +208,7 @@ class ConfigurationControllerTest extends TestCase
|
||||
],
|
||||
];
|
||||
|
||||
$response = $this->post('/api/v1/configuration', $data);
|
||||
$response = $this->post('/api/v1/configuration/single_user_mode', $data);
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson($expected);
|
||||
}
|
||||
@@ -223,14 +221,11 @@ class ConfigurationControllerTest extends TestCase
|
||||
public function testUpdateInvalid(): void
|
||||
{
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(true);
|
||||
$data = [
|
||||
'name' => 'last_update_check',
|
||||
'value' => 'true',
|
||||
];
|
||||
$response = $this->post('/api/v1/configuration', $data);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('You cannot edit this configuration value.');
|
||||
$response = $this->post('/api/v1/configuration/last_update_check', $data);
|
||||
$response->assertStatus(404);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -244,7 +239,7 @@ class ConfigurationControllerTest extends TestCase
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->atLeast()->once()->andReturn(false);
|
||||
|
||||
Passport::actingAs($this->emptyUser());
|
||||
$response = $this->post('/api/v1/configuration');
|
||||
$response = $this->post('/api/v1/configuration/single_user_mode');
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('No access to method.');
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class CurrencyControllerTest extends TestCase
|
||||
$currency = TransactionCurrency::first();
|
||||
|
||||
// call API
|
||||
$response = $this->delete('/api/v1/currencies/' . $currency->id);
|
||||
$response = $this->delete('/api/v1/currencies/' . $currency->code);
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
@@ -132,7 +132,7 @@ class CurrencyControllerTest extends TestCase
|
||||
$repository->shouldReceive('setUser')->once();
|
||||
|
||||
// test API
|
||||
$response = $this->get('/api/v1/currencies/' . $currency->id);
|
||||
$response = $this->get('/api/v1/currencies/' . $currency->code);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson(
|
||||
['data' => [
|
||||
@@ -245,7 +245,7 @@ class CurrencyControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->put('/api/v1/currencies/' . $currency->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/currencies/' . $currency->code, $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -285,7 +285,7 @@ class CurrencyControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->put('/api/v1/currencies/' . $currency->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/currencies/' . $currency->code, $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
|
||||
@@ -66,16 +66,6 @@ class PreferencesControllerTest extends TestCase
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
public function testShow(): void
|
||||
{
|
||||
/** @var Preference $preference */
|
||||
$preference = $this->user()->preferences()->first();
|
||||
|
||||
$response = $this->get('/api/v1/preferences/' . $preference->id);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($preference->name);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\PreferenceController
|
||||
* @covers \FireflyIII\Api\V1\Requests\PreferenceRequest
|
||||
@@ -85,7 +75,7 @@ class PreferencesControllerTest extends TestCase
|
||||
/** @var Preference $preference */
|
||||
$preference = Preferences::setForUser($this->user(), 'frontPageAccounts', [1, 2, 3]);
|
||||
$data = ['data' => '4,5,6'];
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee($preference->name);
|
||||
$response->assertStatus(200);
|
||||
|
||||
@@ -100,7 +90,7 @@ class PreferencesControllerTest extends TestCase
|
||||
/** @var Preference $preference */
|
||||
$preference = Preferences::setForUser($this->user(), 'twoFactorAuthEnabled', false);
|
||||
$data = ['data' => '1'];
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee($preference->name);
|
||||
$response->assertStatus(200);
|
||||
|
||||
@@ -115,7 +105,7 @@ class PreferencesControllerTest extends TestCase
|
||||
/** @var Preference $preference */
|
||||
$preference = Preferences::setForUser($this->user(), 'currencyPreference', false);
|
||||
$data = ['data' => 'EUR'];
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee($preference->name);
|
||||
$response->assertStatus(200);
|
||||
|
||||
@@ -130,7 +120,7 @@ class PreferencesControllerTest extends TestCase
|
||||
/** @var Preference $preference */
|
||||
$preference = Preferences::setForUser($this->user(), 'listPageSize', 13);
|
||||
$data = ['data' => '434'];
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee($preference->name);
|
||||
$response->assertStatus(200);
|
||||
|
||||
|
||||
@@ -118,14 +118,14 @@ class RuleControllerTest extends TestCase
|
||||
'strict' => 1,
|
||||
'stop_processing' => 1,
|
||||
'active' => 1,
|
||||
'rule_triggers' => [
|
||||
'triggers' => [
|
||||
[
|
||||
'name' => 'description_is',
|
||||
'value' => 'Hello',
|
||||
'stop_processing' => 1,
|
||||
],
|
||||
],
|
||||
'rule_actions' => [
|
||||
'actions' => [
|
||||
[
|
||||
'name' => 'add_tag',
|
||||
'value' => 'A',
|
||||
@@ -158,14 +158,14 @@ class RuleControllerTest extends TestCase
|
||||
'strict' => 1,
|
||||
'stop_processing' => 1,
|
||||
'active' => 1,
|
||||
'rule_triggers' => [
|
||||
'triggers' => [
|
||||
[
|
||||
'name' => 'description_is',
|
||||
'value' => 'Hello',
|
||||
'stop_processing' => 1,
|
||||
],
|
||||
],
|
||||
'rule_actions' => [
|
||||
'actions' => [
|
||||
],
|
||||
];
|
||||
|
||||
@@ -190,9 +190,9 @@ class RuleControllerTest extends TestCase
|
||||
'strict' => 1,
|
||||
'stop_processing' => 1,
|
||||
'active' => 1,
|
||||
'rule_triggers' => [
|
||||
'triggers' => [
|
||||
],
|
||||
'rule_actions' => [
|
||||
'actions' => [
|
||||
[
|
||||
'name' => 'add_tag',
|
||||
'value' => 'A',
|
||||
@@ -225,14 +225,14 @@ class RuleControllerTest extends TestCase
|
||||
'strict' => 1,
|
||||
'stop_processing' => 1,
|
||||
'active' => 1,
|
||||
'rule_triggers' => [
|
||||
'triggers' => [
|
||||
[
|
||||
'name' => 'description_is',
|
||||
'value' => 'Hello',
|
||||
'stop_processing' => 1,
|
||||
],
|
||||
],
|
||||
'rule_actions' => [
|
||||
'actions' => [
|
||||
[
|
||||
'name' => 'add_tag',
|
||||
'value' => 'A',
|
||||
|
||||
@@ -1231,7 +1231,9 @@ class TransactionControllerTest extends TestCase
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||
$repository->shouldReceive('setUser');
|
||||
|
||||
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
@@ -1242,6 +1244,8 @@ class TransactionControllerTest extends TestCase
|
||||
$collector->shouldReceive('setLimit')->andReturnSelf();
|
||||
$collector->shouldReceive('setPage')->andReturnSelf();
|
||||
$collector->shouldReceive('setTypes')->andReturnSelf();
|
||||
|
||||
|
||||
$collector->shouldReceive('getPaginatedTransactions')->andReturn($paginator);
|
||||
|
||||
|
||||
@@ -1284,6 +1288,9 @@ class TransactionControllerTest extends TestCase
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||
$repository->shouldReceive('setUser');
|
||||
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
@@ -1351,6 +1358,9 @@ class TransactionControllerTest extends TestCase
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||
$repository->shouldReceive('setUser');
|
||||
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
@@ -1410,6 +1420,9 @@ class TransactionControllerTest extends TestCase
|
||||
$repository = $this->mock(JournalRepositoryInterface::class);
|
||||
$collector = $this->mock(TransactionCollectorInterface::class);
|
||||
$repository->shouldReceive('setUser');
|
||||
$repository->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$repository->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$repository->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
$collector->shouldReceive('setUser')->andReturnSelf();
|
||||
$collector->shouldReceive('withOpposingAccount')->andReturnSelf();
|
||||
@@ -1461,6 +1474,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1508,6 +1524,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1554,6 +1573,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1601,6 +1623,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1646,6 +1671,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1692,6 +1720,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection);
|
||||
$accountRepos->shouldReceive('findByName')->andReturn($account);
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->atLeast()->once()->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->atLeast()->once()->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->atLeast()->once()->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1738,6 +1769,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1783,6 +1817,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1829,6 +1866,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1876,6 +1916,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1922,6 +1965,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -1975,6 +2021,10 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
$data = [
|
||||
'description' => 'Some transaction #' . random_int(1, 10000),
|
||||
'date' => '2018-01-01',
|
||||
@@ -2014,6 +2064,10 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2066,6 +2120,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2113,6 +2170,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2160,6 +2220,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2206,6 +2269,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2252,6 +2318,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]), new Collection([$opposing]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2298,6 +2367,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2345,6 +2417,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2391,6 +2466,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$source]), new Collection([$dest]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2435,6 +2513,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2480,6 +2561,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2539,6 +2623,9 @@ class TransactionControllerTest extends TestCase
|
||||
$accountRepos->shouldReceive('setUser');
|
||||
$accountRepos->shouldReceive('getAccountsById')->andReturn(new Collection([$account]));
|
||||
$journalRepos->shouldReceive('store')->andReturn($journal)->once();
|
||||
$journalRepos->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$journalRepos->shouldReceive('getMetaField')->andReturn(null);
|
||||
$journalRepos->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
try {
|
||||
$this->expectsEvents(StoredTransactionJournal::class);
|
||||
@@ -2604,6 +2691,9 @@ class TransactionControllerTest extends TestCase
|
||||
$transaction = $deposit->transactions()->first();
|
||||
$repository->shouldReceive('setUser');
|
||||
$repository->shouldReceive('update')->andReturn($deposit)->once();
|
||||
$repository->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$repository->shouldReceive('getMetaField')->andReturn(null);
|
||||
$repository->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
// call API
|
||||
$response = $this->put('/api/v1/transactions/' . $transaction->id, $data);
|
||||
@@ -2648,6 +2738,9 @@ class TransactionControllerTest extends TestCase
|
||||
$transaction = $withdrawal->transactions()->first();
|
||||
$repository->shouldReceive('setUser');
|
||||
$repository->shouldReceive('update')->andReturn($withdrawal)->once();
|
||||
$repository->shouldReceive('getNoteText')->andReturn('Note');
|
||||
$repository->shouldReceive('getMetaField')->andReturn(null);
|
||||
$repository->shouldReceive('getMetaDateString')->andReturn('2018-01-01');
|
||||
|
||||
// call API
|
||||
$response = $this->put('/api/v1/transactions/' . $transaction->id, $data);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* JournalLinkControllerTest.php
|
||||
* TransactionLinkControllerTest.php
|
||||
* Copyright (c) 2018 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This file is part of Firefly III.
|
||||
@@ -37,9 +37,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class JournalLinkControllerTest
|
||||
* Class TransactionLinkControllerTest
|
||||
*/
|
||||
class JournalLinkControllerTest extends TestCase
|
||||
class TransactionLinkControllerTest extends TestCase
|
||||
{
|
||||
/**
|
||||
*
|
||||
@@ -53,7 +53,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
*/
|
||||
public function testDelete(): void
|
||||
{
|
||||
@@ -71,12 +71,12 @@ class JournalLinkControllerTest extends TestCase
|
||||
$journalLink = TransactionJournalLink::first();
|
||||
|
||||
// call API
|
||||
$response = $this->delete('/api/v1/journal_links/' . $journalLink->id);
|
||||
$response = $this->delete('/api/v1/transaction_links/' . $journalLink->id);
|
||||
$response->assertStatus(204);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
*/
|
||||
public function testIndex(): void
|
||||
{
|
||||
@@ -104,13 +104,13 @@ class JournalLinkControllerTest extends TestCase
|
||||
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
|
||||
|
||||
// call API
|
||||
$response = $this->get('/api/v1/journal_links');
|
||||
$response = $this->get('/api/v1/transaction_links');
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($journalLinks->first()->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
*/
|
||||
public function testShow(): void
|
||||
{
|
||||
@@ -135,13 +135,13 @@ class JournalLinkControllerTest extends TestCase
|
||||
$collector->shouldReceive('getTransactions')->andReturn(new Collection([$transaction]));
|
||||
|
||||
// call API
|
||||
$response = $this->get('/api/v1/journal_links/' . $journalLink->id);
|
||||
$response = $this->get('/api/v1/transaction_links/' . $journalLink->id);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($journalLink->id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testStore(): void
|
||||
@@ -183,7 +183,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/journal_links', $data);
|
||||
$response = $this->post('/api/v1/transaction_links', $data);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($journalLink->created_at->toAtomString()); // the creation moment.
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -192,7 +192,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
/**
|
||||
* In this particular test the journal link request will fail.
|
||||
*
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testStoreExistingLink(): void
|
||||
@@ -233,7 +233,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertSee('Already have a link between inward and outward.');
|
||||
|
||||
@@ -244,7 +244,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
/**
|
||||
* In this particular test the JournalLinkRequest will report the failure.
|
||||
*
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testStoreInvalidInward(): void
|
||||
@@ -285,7 +285,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
||||
$response->assertStatus(422);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
@@ -294,7 +294,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
/**
|
||||
* In this particular test the JournalLinkRequest will report the failure.
|
||||
*
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testStoreInvalidOutward(): void
|
||||
@@ -335,14 +335,14 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee('Invalid outward ID.');
|
||||
$response->assertStatus(422);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testStoreNoJournal(): void
|
||||
@@ -384,14 +384,14 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testStoreWithNull(): void
|
||||
@@ -431,14 +431,14 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/journal_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertSee('Invalid inward ID.'); // error message
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testUpdate(): void
|
||||
@@ -481,14 +481,14 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->put('/api/v1/journal_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertSee($journalLink->created_at->toAtomString()); // the creation moment.
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testUpdateNoJournal(): void
|
||||
@@ -531,14 +531,14 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->put('/api/v1/journal_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers \FireflyIII\Api\V1\Controllers\JournalLinkController
|
||||
* @covers \FireflyIII\Api\V1\Controllers\TransactionLinkController
|
||||
* @covers \FireflyIII\Api\V1\Requests\JournalLinkRequest
|
||||
*/
|
||||
public function testUpdateWithNull(): void
|
||||
@@ -579,7 +579,7 @@ class JournalLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->put('/api/v1/journal_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
Reference in New Issue
Block a user