GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

Issues (387)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

tests/Feature/TransactionControllerTest.php (10 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Tests\Feature;
4
5
use App\Models\Account;
6
use App\Models\Category;
7
use App\Models\Payee;
8
use App\Models\Transaction;
9
use App\Models\TransactionStatus;
10
use App\Models\TransactionType;
11
use Carbon\Carbon;
12
use Tests\Features\FeatureTestCase;
13
14
class TransactionControllerTest extends FeatureTestCase
15
{
16
    /**
17
     * @test
18
     */
19
    public function it_can_create_a_transaction_with_all_properties()
20
    {
21
        // Arrange
22
        $status = factory(TransactionStatus::class)->create();
23
        $type = factory(TransactionType::class)->create();
24
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
25
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
26
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
27
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
28
29
        // TODO: Test fileupload
30
        //Storage::fake('media');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
31
        $data = [
32
            'transaction_date'   => '12/31/2017',
33
            'transaction_status' => $status->id,
34
            'transaction_type'   => $type->id,
35
            'account'            => $account->id,
36
            'payee'              => $payee->id,
37
            'category'           => $category->id,
38
            'subcategory'        => $subcategory->id,
39
            'amount'             => 13.37,
40
            'notes'              => 'Some notes',
41
            //'attachments'        => [UploadedFile::fake()->image('receipt.jpg')]
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
42
        ];
43
44
        // Act
45
        $this->ensureAuthenticated();
46
        $response = $this->post('/transactions', $data);
47
48
        // Assert
49
        $response->assertRedirect('/');
50
51
        $this->assertDatabaseHas('transactions', [
52
            'user_id'           => $this->user->id,
53
            'transaction_date'  => Carbon::create(2017, 12, 31, 0, 0, 0)->toDateTimeString(),
54
            'status_id'         => $status->id,
55
            'type_id'           => $type->id,
56
            'account_name'      => $account->name,
57
            'to_account_name'   => null,
58
            'payee_name'        => $payee->name,
59
            'sub_category_name' => $subcategory->name,
60
            'amount'            => 13.37,
61
            'notes'             => 'Some notes',
62
        ]);
63
64
        //$lastTransaction = Transaction::latest()->get()->first();
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
65
        //$filename = 'Transaction_'.$lastTransaction->id.'_receipt.png';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
66
        //Storage::disk('media')->assertExists($lastTransaction->id.'/'.$filename);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
67
    }
68
69
    /**
70
     * @test
71
     */
72
    public function it_can_edit_an_existing_transaction()
73
    {
74
        // Arrange
75
        $transaction = factory(Transaction::class)->create(['user_id' => $this->user->id]);
76
77
        $status = factory(TransactionStatus::class)->create();
78
        $type = factory(TransactionType::class)->create();
79
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
80
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
81
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
82
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
83
84
        // TODO: Test fileupload
85
        //Storage::fake('media');
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
86
        $data = [
87
            'transaction_date'   => '12/31/2017',
88
            'transaction_status' => $status->id,
89
            'transaction_type'   => $type->id,
90
            'account'            => $account->id,
91
            'payee'              => $payee->id,
92
            'category'           => $category->id,
93
            'subcategory'        => $subcategory->id,
94
            'amount'             => 13.37,
95
            'notes'              => 'Some notes',
96
            //'attachments'        => [UploadedFile::fake()->image('receipt.jpg')]
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
97
        ];
98
99
        // Act
100
        $this->ensureAuthenticated();
101
        $response = $this->put('/transactions/'.$transaction->id, $data);
102
103
        // Assert
104
        $response->assertRedirect('/');
105
106
        $this->assertDatabaseHas('transactions', [
107
            'id'                => $transaction->id,
108
            'user_id'           => $this->user->id,
109
            'transaction_date'  => Carbon::create(2017, 12, 31, 0, 0, 0)->toDateTimeString(),
110
            'status_id'         => $status->id,
111
            'type_id'           => $type->id,
112
            'account_name'      => $account->name,
113
            'to_account_name'   => null,
114
            'payee_name'        => $payee->name,
115
            'category_name'     => $category->name,
116
            'sub_category_name' => $subcategory->name,
117
            'amount'            => 13.37,
118
            'notes'             => 'Some notes',
119
        ]);
120
121
        //$lastTransaction = Transaction::latest()->get()->first();
0 ignored issues
show
Unused Code Comprehensibility introduced by
62% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
122
        //$filename = 'Transaction_'.$lastTransaction->id.'_receipt.png';
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
123
        //Storage::disk('media')->assertExists($lastTransaction->id.'/'.$filename);
0 ignored issues
show
Unused Code Comprehensibility introduced by
67% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
124
    }
125
126
    /**
127
     * @test
128
     */
129
    public function it_stores_last_used_category_by_payee_in_payees_table_on_create()
130
    {
131
        // Arrange
132
        $type = factory(TransactionType::class)->create();
133
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
134
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
135
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
136
137
        $data = [
138
            'transaction_type' => $type->id,
139
            'account'          => $account->id,
140
            'payee'            => $payee->id,
141
            'category'         => $category->id,
142
            'amount'           => 13.37,
143
        ];
144
145
        // Act
146
        $this->ensureAuthenticated();
147
        $response = $this->post('/transactions', $data);
148
149
        // Assert
150
        $response->assertRedirect('/');
151
        $this->assertDatabaseHas('payees', ['user_id' => $this->user->id, 'id' => $payee->id, 'last_category_id' => $category->id]);
152
    }
153
154
    /**
155
     * @test
156
     */
157
    public function it_stores_last_used_category_by_payee_in_payees_table_on_update()
158
    {
159
        // Arrange
160
        $transaction = factory(Transaction::class)->create(['user_id' => $this->user->id]);
161
162
        $type = factory(TransactionType::class)->create();
163
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
164
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
165
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
166
167
        $data = [
168
            'transaction_type' => $type->id,
169
            'account'          => $account->id,
170
            'payee'            => $payee->id,
171
            'category'         => $category->id,
172
            'amount'           => 13.37,
173
        ];
174
175
        // Act
176
        $this->ensureAuthenticated();
177
        $response = $this->put('/transactions/'.$transaction->id, $data);
178
179
        // Assert
180
        $response->assertRedirect('/');
181
        $this->assertDatabaseHas('payees', ['user_id' => $this->user->id, 'id' => $payee->id, 'last_category_id' => $category->id]);
182
    }
183
184
    /**
185
     * @test
186
     */
187
    public function it_stores_last_used_subcategory_by_payee_in_payees_table_on_create()
188
    {
189
        // Arrange
190
        $type = factory(TransactionType::class)->create();
191
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
192
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
193
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
194
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
195
196
        $data = [
197
            'transaction_type' => $type->id,
198
            'account'          => $account->id,
199
            'payee'            => $payee->id,
200
            'category'         => $category->id,
201
            'subcategory'      => $subcategory->id,
202
            'amount'           => 13.37,
203
        ];
204
205
        // Act
206
        $this->ensureAuthenticated();
207
        $response = $this->post('/transactions', $data);
208
209
        // Assert
210
        $response->assertRedirect('/');
211
        $this->assertDatabaseHas('payees', ['user_id' => $this->user->id, 'id' => $payee->id, 'last_category_id' => $subcategory->id]);
212
    }
213
214
    /**
215
     * @test
216
     */
217
    public function it_stores_last_used_subcategory_by_payee_in_payees_table_on_update()
218
    {
219
        // Arrange
220
        $transaction = factory(Transaction::class)->create(['user_id' => $this->user->id]);
221
222
        $type = factory(TransactionType::class)->create();
223
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
224
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
225
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
226
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
227
228
        $data = [
229
            'transaction_type' => $type->id,
230
            'account'          => $account->id,
231
            'payee'            => $payee->id,
232
            'category'         => $category->id,
233
            'subcategory'      => $subcategory->id,
234
            'amount'           => 13.37,
235
        ];
236
237
        // Act
238
        $this->ensureAuthenticated();
239
        $response = $this->put('/transactions/'.$transaction->id, $data);
240
241
        // Assert
242
        $response->assertRedirect('/');
243
        $this->assertDatabaseHas('payees', ['user_id' => $this->user->id, 'id' => $payee->id, 'last_category_id' => $subcategory->id]);
244
    }
245
246
    /**
247
     * @test
248
     */
249
    public function it_stores_account_to_on_transfer_transactions()
250
    {
251
        // Arrange
252
        $type = factory(TransactionType::class)->create();
253
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
254
        $toaccount = factory(Account::class)->create(['user_id' => $this->user->id]);
255
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
256
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
257
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
258
259
        $data = [
260
            'transaction_type' => $type->id,
261
            'account'          => $account->id,
262
            'to_account'       => $toaccount->id,
263
            'payee'            => $payee->id,
264
            'category'         => $category->id,
265
            'subcategory'      => $subcategory->id,
266
            'amount'           => 13.37,
267
        ];
268
269
        // Act
270
        $this->ensureAuthenticated();
271
        $response = $this->post('/transactions', $data);
272
273
        // Assert
274
        $response->assertRedirect('/');
275
        $this->assertDatabaseHas('transactions', [
276
            'user_id'           => $this->user->id,
277
            'type_id'           => $type->id,
278
            'account_name'      => $account->name,
279
            'to_account_name'   => $toaccount->name,
280
            'payee_name'        => $payee->name,
281
            'category_name'     => $category->name,
282
            'sub_category_name' => $subcategory->name,
283
        ]);
284
    }
285
286
    /**
287
     * @test
288
     */
289
    public function it_stores_last_used_date_by_payee_in_payees_table_on_create()
290
    {
291
        // Arrange
292
        $knownDate = Carbon::create(2017, 07, 16, 12);
293
        Carbon::setTestNow($knownDate);
294
295
        $type = factory(TransactionType::class)->create();
296
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
297
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
298
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
299
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
300
301
        $data = [
302
            'transaction_type' => $type->id,
303
            'account'          => $account->id,
304
            'payee'            => $payee->id,
305
            'category'         => $category->id,
306
            'subcategory'      => $subcategory->id,
307
            'amount'           => 13.37,
308
        ];
309
310
        // Act
311
        $this->ensureAuthenticated();
312
        $response = $this->post('/transactions', $data);
313
314
        // Assert
315
        $response->assertRedirect('/');
316
        $this->assertDatabaseHas('payees', ['user_id' => $this->user->id, 'id' => $payee->id, 'last_used_at' => Carbon::now()->toDateTimeString()]);
317
    }
318
319
    /**
320
     * @test
321
     */
322
    public function it_stores_last_used_date_by_payee_in_payees_table_on_update()
323
    {
324
        // Arrange
325
        $knownDate = Carbon::create(2017, 07, 16, 12);
326
        Carbon::setTestNow($knownDate);
327
328
        $transaction = factory(Transaction::class)->create(['user_id' => $this->user->id]);
329
330
        $type = factory(TransactionType::class)->create();
331
        $account = factory(Account::class)->create(['user_id' => $this->user->id]);
332
        $payee = factory(Payee::class)->create(['user_id' => $this->user->id]);
333
        $category = factory(Category::class)->create(['user_id' => $this->user->id]);
334
        $subcategory = factory(Category::class)->create(['user_id' => $this->user->id, 'parent_id' => $category->id]);
335
336
        $data = [
337
            'transaction_type' => $type->id,
338
            'account'          => $account->id,
339
            'payee'            => $payee->id,
340
            'category'         => $category->id,
341
            'subcategory'      => $subcategory->id,
342
            'amount'           => 13.37,
343
        ];
344
345
        // Act
346
        $this->ensureAuthenticated();
347
        $response = $this->put('/transactions/'.$transaction->id, $data);
348
349
        // Assert
350
        $response->assertRedirect('/');
351
        $this->assertDatabaseHas('payees', ['user_id' => $this->user->id, 'id' => $payee->id, 'last_used_at' => Carbon::now()->toDateTimeString()]);
352
    }
353
}
354