Fix route calls [skip ci]

This commit is contained in:
James Cole 2019-06-09 10:27:11 +02:00
parent 2b76b4a2b2
commit c02ab6f6d8
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
8 changed files with 17 additions and 16 deletions

View File

@ -163,7 +163,7 @@ class BudgetLimitControllerTest extends TestCase
$repository->shouldReceive('setUser')->once();
// call API
$response = $this->put('/api/v1/budgets/limits/' . $budgetLimit->id, $data);
$response = $this->put(route('api.v1.budget_limits.update', [$budgetLimit->id]), $data);
$response->assertStatus(200);
$response->assertHeader('Content-Type', 'application/vnd.api+json');

View File

@ -171,7 +171,7 @@ class CurrencyControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/currencies/' . $currency->code, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.currencies.update', [$currency->code]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
$response->assertHeader('Content-Type', 'application/vnd.api+json');
@ -216,7 +216,7 @@ class CurrencyControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/currencies/' . $currency->code, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.currencies.update', [$currency->code]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
$response->assertHeader('Content-Type', 'application/vnd.api+json');

View File

@ -168,7 +168,7 @@ class LinkTypeControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/link_types/' . $linkType->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.link_types.update', [$linkType->id]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertHeader('Content-Type', 'application/vnd.api+json');
}
@ -206,7 +206,7 @@ class LinkTypeControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/link_types/' . $linkType->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.link_types.update', [$linkType->id]), $data, ['Accept' => 'application/json']);
$response->assertStatus(500);
$response->assertSee('You cannot edit this link type ');
}
@ -247,7 +247,7 @@ class LinkTypeControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/link_types/' . $linkType->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.link_types.update', [$linkType->id]), $data, ['Accept' => 'application/json']);
$response->assertStatus(500);
$response->assertSee('You need the \"owner\"-role to do this.');
}

View File

@ -163,7 +163,7 @@ class PiggyBankControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/piggy_banks/' . $piggy->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.piggy_banks.update', [$piggy->id]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertJson(['data' => ['type' => 'piggy_banks', 'links' => true],]);
$response->assertHeader('Content-Type', 'application/vnd.api+json');

View File

@ -67,7 +67,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->name, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.preferences.update', [$preference->name]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
}
@ -89,7 +89,8 @@ class PreferencesControllerTest extends TestCase
/** @var Preference $preference */
$preference = Preferences::setForUser($this->user(), 'twoFactorAuthEnabled', false);
$data = ['data' => '1'];
$response = $this->put('/api/v1/preferences/' . $preference->name, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.preferences.update', [$preference->name]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
}
@ -111,7 +112,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->name, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.preferences.update', [$preference->name]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
}
@ -133,7 +134,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->name, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.preferences.update', [$preference->name]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
}

View File

@ -1455,7 +1455,7 @@ class RecurrenceControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/recurrences/' . $recurrence->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.recurrences.update', [$recurrence->id]), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertHeader('Content-Type', 'application/vnd.api+json');
}

View File

@ -342,7 +342,7 @@ class TransactionLinkControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.transaction_links.update', $journalLink->id), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
$response->assertHeader('Content-Type', 'application/vnd.api+json');
}
@ -381,7 +381,7 @@ class TransactionLinkControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.transaction_links.update', $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');
@ -418,7 +418,7 @@ class TransactionLinkControllerTest extends TestCase
];
// test API
$response = $this->put('/api/v1/transaction_links/' . $journalLink->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.transaction_links.update', $journalLink->id), $data, ['Accept' => 'application/json']);
$response->assertStatus(422);
$response->assertSee('Invalid inward ID.'); // the creation moment.
$response->assertHeader('Content-Type', 'application/json');

View File

@ -207,7 +207,7 @@ class UserControllerTest extends TestCase
$transformer->shouldReceive('transform')->atLeast()->once()->andReturn(['id' => 5]);
// call API
$response = $this->put('/api/v1/users/' . $user->id, $data, ['Accept' => 'application/json']);
$response = $this->put(route('api.v1.users.update', $user->id), $data, ['Accept' => 'application/json']);
$response->assertStatus(200);
}