mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-03 03:00:14 +00:00
Suppress PHPMD messages and make sure to use route() [skip ci]
This commit is contained in:
@@ -33,6 +33,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class AccountControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class AccountControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -35,6 +35,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class AttachmentControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class AttachmentControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -38,6 +38,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class AvailableBudgetControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class AvailableBudgetControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -33,6 +33,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class BillControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class BillControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -44,6 +44,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class BudgetControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class BudgetControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -43,6 +43,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class BudgetLimitControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class BudgetLimitControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -42,6 +42,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class CategoryControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class CategoryControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -60,6 +60,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class CurrencyControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class CurrencyControllerTest extends TestCase
|
||||
{
|
||||
@@ -108,7 +111,7 @@ class CurrencyControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/currencies', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.currencies.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -153,7 +156,7 @@ class CurrencyControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/currencies', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.currencies.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson(['data' => ['type' => 'currencies', 'links' => true],]);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
|
@@ -35,6 +35,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class LinkTypeControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class LinkTypeControllerTest extends TestCase
|
||||
{
|
||||
@@ -85,7 +88,7 @@ class LinkTypeControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/link_types', $data);
|
||||
$response = $this->post(route('api.v1.link_types.store'), $data);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -115,7 +118,7 @@ class LinkTypeControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/link_types', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.link_types.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('You need the \"owner\"-role to do this.');
|
||||
}
|
||||
|
@@ -37,6 +37,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class PiggyBankControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class PiggyBankControllerTest extends TestCase
|
||||
{
|
||||
@@ -81,7 +84,7 @@ class PiggyBankControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/piggy_banks/', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.piggy_banks.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertJson(['data' => ['type' => 'piggy_banks', 'links' => true],]);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -109,7 +112,7 @@ class PiggyBankControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/piggy_banks/', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.piggy_banks.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(500);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
$response->assertSee('Could not store new piggy bank.');
|
||||
|
@@ -34,6 +34,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class PreferencesControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class PreferencesControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -41,6 +41,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class RecurrenceControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class RecurrenceControllerTest extends TestCase
|
||||
{
|
||||
@@ -116,7 +119,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -183,7 +186,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -251,7 +254,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -321,7 +324,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
@@ -392,7 +395,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -452,7 +455,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -521,7 +524,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -587,7 +590,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -655,7 +658,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -723,7 +726,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -788,7 +791,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -853,7 +856,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -919,7 +922,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -985,7 +988,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -1050,7 +1053,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -1122,7 +1125,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -1191,7 +1194,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -1253,7 +1256,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -1306,7 +1309,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
'message' => 'The given data was invalid.',
|
||||
@@ -1387,7 +1390,7 @@ class RecurrenceControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/recurrences', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.recurrences.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
|
@@ -36,6 +36,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class TagControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class TagControllerTest extends TestCase
|
||||
{
|
||||
|
@@ -39,6 +39,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class TransactionControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class TransactionControllerTest extends TestCase
|
||||
{
|
||||
@@ -93,7 +96,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -148,7 +151,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -203,7 +206,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -257,7 +260,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -311,7 +314,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -372,7 +375,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -410,7 +413,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -473,7 +476,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -537,7 +540,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -604,7 +607,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
@@ -686,7 +689,7 @@ class TransactionControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transactions', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transactions.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(200);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
|
@@ -39,6 +39,9 @@ use Tests\TestCase;
|
||||
/**
|
||||
*
|
||||
* Class TransactionLinkControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class TransactionLinkControllerTest extends TestCase
|
||||
{
|
||||
@@ -100,7 +103,7 @@ class TransactionLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transaction_links', $data);
|
||||
$response = $this->post(route('api.v1.transaction_links.store'), $data);
|
||||
$response->assertStatus(200);
|
||||
$response->assertHeader('Content-Type', 'application/vnd.api+json');
|
||||
}
|
||||
@@ -152,7 +155,7 @@ class TransactionLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transaction_links.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertSee('Already have a link between inward and outward.');
|
||||
|
||||
@@ -207,7 +210,7 @@ class TransactionLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transaction_links.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee('Invalid inward ID.'); // the creation moment.
|
||||
$response->assertStatus(422);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
@@ -260,7 +263,7 @@ class TransactionLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transaction_links.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertSee('Invalid outward ID.');
|
||||
$response->assertStatus(422);
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
@@ -312,7 +315,7 @@ class TransactionLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transaction_links.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(500);
|
||||
$response->assertSee('Source or destination is NULL.'); // the creation moment.
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
@@ -362,7 +365,7 @@ class TransactionLinkControllerTest extends TestCase
|
||||
];
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/transaction_links', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.transaction_links.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertSee('Invalid inward ID.'); // error message
|
||||
$response->assertHeader('Content-Type', 'application/json');
|
||||
|
@@ -35,6 +35,9 @@ use Tests\TestCase;
|
||||
|
||||
/**
|
||||
* Class UserControllerTest
|
||||
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class UserControllerTest extends TestCase
|
||||
{
|
||||
@@ -76,7 +79,7 @@ class UserControllerTest extends TestCase
|
||||
$transformer->shouldReceive('transform')->atLeast()->once()->andReturn(['id' => 5]);
|
||||
|
||||
// test API
|
||||
$response = $this->post('/api/v1/users', $data, ['Content-Type' => 'application/x-www-form-urlencoded']);
|
||||
$response = $this->post(route('api.v1.users.store'), $data, ['Content-Type' => 'application/x-www-form-urlencoded']);
|
||||
$response->assertStatus(200);
|
||||
}
|
||||
|
||||
@@ -129,7 +132,7 @@ class UserControllerTest extends TestCase
|
||||
$userRepos = $this->mock(UserRepositoryInterface::class);
|
||||
$userRepos->shouldReceive('hasRole')->withArgs([Mockery::any(), 'owner'])->twice()->andReturn(true);
|
||||
// test API
|
||||
$response = $this->post('/api/v1/users', $data, ['Accept' => 'application/json']);
|
||||
$response = $this->post(route('api.v1.users.store'), $data, ['Accept' => 'application/json']);
|
||||
$response->assertStatus(422);
|
||||
$response->assertExactJson(
|
||||
[
|
||||
|
Reference in New Issue
Block a user