Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Test Setup Failed
Push — master ( 82f512...2f1651 )
by Cristian
13:55 queued 02:59
created

CrudControllerTest::testSetRouteName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\Http;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
6
use Backpack\CRUD\Tests\BaseTest;
7
8
class CrudControllerTest extends BaseTest
9
{
10
    private $crudPanel;
11
12
    /**
13
     * Define environment setup.
14
     *
15
     * @param  \Illuminate\Foundation\Application  $app
16
     * @return void
17
     */
18
    protected function getEnvironmentSetUp($app)
19
    {
20
        parent::getEnvironmentSetUp($app);
21
22
        $controller = '\Backpack\CRUD\Tests\Unit\Http\Controllers\UserCrudController';
23
24
        $app['router']->get('users/{id}/edit', "$controller@edit");
25
        $app['router']->put('users/{id}', "$controller@update");
26
27
        $app['router']->get('admin/users', "$controller@index")->name('admin.users.index');
28
29
        $app->singleton('crud', function ($app) {
30
            return new CrudPanel($app);
0 ignored issues
show
Unused Code introduced by
The call to Backpack\CRUD\app\Librar...rudPanel::__construct() has too many arguments starting with $app. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

30
            return /** @scrutinizer ignore-call */ new CrudPanel($app);

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.

Loading history...
31
        });
32
33
        $this->crudPanel = app('crud');
34
    }
35
36
    public function testSetRouteName()
37
    {
38
        $this->crudPanel->setRouteName('admin.users');
39
40
        $this->assertEquals(url('admin/users'), $this->crudPanel->getRoute());
41
    }
42
43
    public function testCrudRequestUpdatesOnEachRequest()
44
    {
45
        $crud = app('crud');
46
47
        // create a first request
48
        $firstRequest = request()->create('/users/1/edit', 'GET');
49
        app()->handle($firstRequest);
0 ignored issues
show
introduced by
The method handle() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

49
        app()->/** @scrutinizer ignore-call */ handle($firstRequest);
Loading history...
50
51
        // see if the first global request has been passed to the CRUD object
52
        $this->assertSame($crud->getRequest(), $firstRequest);
53
54
        // create a second request
55
        $secondRequest = request()->create('/users/1', 'PUT', ['name' => 'foo']);
56
        app()->handle($secondRequest);
57
58
        // see if the second global requesst has been passed to the CRUD object
59
        $this->assertSame($crud->getRequest(), $secondRequest);
60
61
        // the CRUD object's request should no longer hold the first request, but the second one
62
        $this->assertNotSame($crud->getRequest(), $firstRequest);
63
    }
64
}
65