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

Passed
Pull Request — next (#5688)
by Cristian
28:38 queued 13:34
created

CrudControllerTest::getEnvironmentSetUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
nc 1
nop 1
dl 0
loc 9
c 0
b 0
f 0
cc 1
rs 10
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\Http;
4
5
use Backpack\CRUD\Backpack;
6
use Backpack\CRUD\Tests\BaseTestClass;
7
8
/**
9
 * @covers Backpack\CRUD\app\Http\Controllers\CrudController
10
 * @covers Backpack\CRUD\app\Library\CrudPanel\CrudPanel
11
 */
12
class CrudControllerTest extends BaseTestClass
13
{
14
    private $crudPanel;
15
16
    /**
17
     * Define environment setup.
18
     *
19
     * @param  \Illuminate\Foundation\Application  $app
20
     * @return void
21
     */
22
    protected function defineEnvironment($app)
23
    {
24
        parent::defineEnvironment($app);
25
26
        $this->crudPanel = Backpack::getCrudPanelInstance();
0 ignored issues
show
Bug introduced by
The method getCrudPanelInstance() does not exist on Backpack\CRUD\Backpack. Since you implemented __callStatic, consider adding a @method annotation. ( Ignorable by Annotation )

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

26
        /** @scrutinizer ignore-call */ 
27
        $this->crudPanel = Backpack::getCrudPanelInstance();
Loading history...
27
        $this->crudPanel->setRequest();
28
    }
29
30
    public function testSetRouteName()
31
    {
32
        $this->crudPanel->setRouteName('users');
33
34
        $this->assertEquals(url('admin/users'), $this->crudPanel->getRoute());
35
    }
36
37
    public function testSetRoute()
38
    {
39
        $this->crudPanel->setRoute(backpack_url('users'));
40
        $this->crudPanel->setEntityNameStrings('singular', 'plural');
41
        $this->assertEquals(route('users.index'), $this->crudPanel->getRoute());
42
    }
43
44
    public function testCrudRequestUpdatesOnEachRequest()
45
    {
46
        // create a first request
47
        $firstRequest = request()->create('admin/users/1/edit', 'GET');
48
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
        $firstRequest = app()->request;
51
52
        // see if the first global request has been passed to the CRUD object
53
        $this->assertSame(app('crud')->getRequest(), $firstRequest);
54
55
        // create a second request
56
        $secondRequest = request()->create('admin/users/1', 'PUT', ['name' => 'foo']);
57
        app()->handle($secondRequest);
58
        $secondRequest = app()->request;
59
60
        // see if the second global request has been passed to the CRUD object
61
        $this->assertSame(app('crud')->getRequest(), $secondRequest);
62
63
        // the CRUD object's request should no longer hold the first request, but the second one
64
        $this->assertNotSame(app('crud')->getRequest(), $firstRequest);
65
    }
66
}
67