Skip to content

Firefly III: a personal finances manager

Suppress PHPMD messages and make sure to use route() [skip ci]

James Colea1929b052167
diff --git a/tests/Api/V1/Controllers/AccountControllerTest.php b/tests/Api/V1/Controllers/AccountControllerTest.php
index 28d724a5cf..638759e365 100644
--- a/tests/Api/V1/Controllers/AccountControllerTest.php
+++ b/tests/Api/V1/Controllers/AccountControllerTest.php
@@ -33,6 +33,9 @@ use Tests\TestCase;
/**
* Class AccountControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class AccountControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/AttachmentControllerTest.php b/tests/Api/V1/Controllers/AttachmentControllerTest.php
index 891860e812..5b5705808b 100644
--- a/tests/Api/V1/Controllers/AttachmentControllerTest.php
+++ b/tests/Api/V1/Controllers/AttachmentControllerTest.php
@@ -35,6 +35,9 @@ use Tests\TestCase;
/**
*
* Class AttachmentControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class AttachmentControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php b/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php
index 08ec2d52b5..88ace3d62b 100644
--- a/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php
+++ b/tests/Api/V1/Controllers/AvailableBudgetControllerTest.php
@@ -38,6 +38,9 @@ use Tests\TestCase;
/**
*
* Class AvailableBudgetControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class AvailableBudgetControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/BillControllerTest.php b/tests/Api/V1/Controllers/BillControllerTest.php
index 160fffc617..14d6392d55 100644
--- a/tests/Api/V1/Controllers/BillControllerTest.php
+++ b/tests/Api/V1/Controllers/BillControllerTest.php
@@ -33,6 +33,9 @@ use Tests\TestCase;
/**
* Class BillControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class BillControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/BudgetControllerTest.php b/tests/Api/V1/Controllers/BudgetControllerTest.php
index b324bceecd..b1a193f348 100644
--- a/tests/Api/V1/Controllers/BudgetControllerTest.php
+++ b/tests/Api/V1/Controllers/BudgetControllerTest.php
@@ -44,6 +44,9 @@ use Tests\TestCase;
/**
*
* Class BudgetControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class BudgetControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/BudgetLimitControllerTest.php b/tests/Api/V1/Controllers/BudgetLimitControllerTest.php
index 7505ac2b4c..23a0d1d631 100644
--- a/tests/Api/V1/Controllers/BudgetLimitControllerTest.php
+++ b/tests/Api/V1/Controllers/BudgetLimitControllerTest.php
@@ -43,6 +43,9 @@ use Tests\TestCase;
/**
*
* Class BudgetLimitControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class BudgetLimitControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/CategoryControllerTest.php b/tests/Api/V1/Controllers/CategoryControllerTest.php
index e9bd1be88c..bf31ab9d4f 100644
--- a/tests/Api/V1/Controllers/CategoryControllerTest.php
+++ b/tests/Api/V1/Controllers/CategoryControllerTest.php
@@ -42,6 +42,9 @@ use Tests\TestCase;
/**
*
* Class CategoryControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class CategoryControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/CurrencyControllerTest.php b/tests/Api/V1/Controllers/CurrencyControllerTest.php
index b1d38f429d..87a6725e3b 100644
--- a/tests/Api/V1/Controllers/CurrencyControllerTest.php
+++ b/tests/Api/V1/Controllers/CurrencyControllerTest.php
@@ -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');
diff --git a/tests/Api/V1/Controllers/LinkTypeControllerTest.php b/tests/Api/V1/Controllers/LinkTypeControllerTest.php
index 46a70f45b7..90839332e4 100644
--- a/tests/Api/V1/Controllers/LinkTypeControllerTest.php
+++ b/tests/Api/V1/Controllers/LinkTypeControllerTest.php
@@ -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.');
}
diff --git a/tests/Api/V1/Controllers/PiggyBankControllerTest.php b/tests/Api/V1/Controllers/PiggyBankControllerTest.php
index 3bb3eb15f8..a559b7f34b 100644
--- a/tests/Api/V1/Controllers/PiggyBankControllerTest.php
+++ b/tests/Api/V1/Controllers/PiggyBankControllerTest.php
@@ -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.');
diff --git a/tests/Api/V1/Controllers/PreferencesControllerTest.php b/tests/Api/V1/Controllers/PreferencesControllerTest.php
index a88a83a60e..503b286f38 100644
--- a/tests/Api/V1/Controllers/PreferencesControllerTest.php
+++ b/tests/Api/V1/Controllers/PreferencesControllerTest.php
@@ -34,6 +34,9 @@ use Tests\TestCase;
/**
*
* Class PreferencesControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class PreferencesControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/RecurrenceControllerTest.php b/tests/Api/V1/Controllers/RecurrenceControllerTest.php
index 1c68fc538a..779f31e277 100644
--- a/tests/Api/V1/Controllers/RecurrenceControllerTest.php
+++ b/tests/Api/V1/Controllers/RecurrenceControllerTest.php
@@ -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');
diff --git a/tests/Api/V1/Controllers/TagControllerTest.php b/tests/Api/V1/Controllers/TagControllerTest.php
index f23d081da8..2bad894d60 100644
--- a/tests/Api/V1/Controllers/TagControllerTest.php
+++ b/tests/Api/V1/Controllers/TagControllerTest.php
@@ -36,6 +36,9 @@ use Tests\TestCase;
/**
* Class TagControllerTest
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
+ * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
+ * @SuppressWarnings(PHPMD.TooManyPublicMethods)
*/
class TagControllerTest extends TestCase
{
diff --git a/tests/Api/V1/Controllers/TransactionControllerTest.php b/tests/Api/V1/Controllers/TransactionControllerTest.php
index 768cb76713..354ac82189 100644
--- a/tests/Api/V1/Controllers/TransactionControllerTest.php
+++ b/tests/Api/V1/Controllers/TransactionControllerTest.php
@@ -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(
[
diff --git a/tests/Api/V1/Controllers/TransactionLinkControllerTest.php b/tests/Api/V1/Controllers/TransactionLinkControllerTest.php
index 81917fdd53..d32e999d94 100644
--- a/tests/Api/V1/Controllers/TransactionLinkControllerTest.php
+++ b/tests/Api/V1/Controllers/TransactionLinkControllerTest.php
@@ -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');
diff --git a/tests/Api/V1/Controllers/UserControllerTest.php b/tests/Api/V1/Controllers/UserControllerTest.php
index 3e18a7b897..10023d5cc3 100644
--- a/tests/Api/V1/Controllers/UserControllerTest.php
+++ b/tests/Api/V1/Controllers/UserControllerTest.php
@@ -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(
[