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 — main (#5601)
by Pedro
19:34 queued 04:43
created

BaseTestClass::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 9
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 13
rs 9.9666
1
<?php
2
3
namespace Backpack\CRUD\Tests;
4
5
use Backpack\Basset\BassetServiceProvider;
6
use Backpack\CRUD\BackpackServiceProvider;
7
use Backpack\CRUD\Tests\config\TestsServiceProvider;
8
use Illuminate\Routing\Route as RouteInstance;
9
use Illuminate\Support\Facades\Route;
10
use Orchestra\Testbench\TestCase;
11
use Prologue\Alerts\AlertsServiceProvider;
12
13
abstract class BaseTestClass extends TestCase
14
{
15
    /**
16
     * Setup the test environment.
17
     *
18
     * @return void
19
     */
20
    protected function setUp(): void
21
    {
22
        parent::setUp();
23
24
        Route::group([
25
            (array) config('backpack.base.web_middleware', 'web'),
26
            (array) config('backpack.base.middleware_key', 'admin'),
27
            'prefix' => config('backpack.base.route_prefix', 'admin'),
28
        ],
29
            function () {
30
                Route::get('articles/{id}/show/{detail}', ['as' => 'article.show.detail', 'action' => 'Backpack\CRUD\Tests\config\Http\Controllers\ArticleCrudController@detail']);
31
                Route::crud('users', 'Backpack\CRUD\Tests\config\Http\Controllers\UserCrudController');
32
                Route::crud('articles', 'Backpack\CRUD\Tests\config\Http\Controllers\ArticleCrudController');
33
            }
34
        );
35
    }
36
37
    protected function getPackageProviders($app)
0 ignored issues
show
Unused Code introduced by
The parameter $app is not used and could be removed. ( Ignorable by Annotation )

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

37
    protected function getPackageProviders(/** @scrutinizer ignore-unused */ $app)

This check looks for parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
38
    {
39
        return [
40
            BassetServiceProvider::class,
41
            BackpackServiceProvider::class,
42
            AlertsServiceProvider::class,
43
            TestsServiceProvider::class,
44
        ];
45
    }
46
47
    protected function setupUserCreateRequest()
48
    {
49
        $request = request()->create('/admin/users/create', 'POST', ['name' => 'foo']);
50
        $request->setRouteResolver(function () use ($request) {
51
            return (new RouteInstance('POST', 'admin/users/create', ['UserCrudController', 'create']))->bind($request);
52
        });
53
        $this->crudPanel->setRequest($request);
54
    }
55
56
    protected function makeAnArticleModel(array $attributes = [])
57
    {
58
        $attributes = array_merge([
59
            'id' => 1,
60
            'content' => 'Some Content',
61
        ], $attributes);
62
63
        return \Backpack\CRUD\Tests\config\Models\Article::make($attributes);
64
    }
65
66
    protected function makeAUserModel(array $attributes = [])
67
    {
68
        $attributes = array_merge([
69
            'id' => 1,
70
            'name' => 'user',
71
            'email' => '[email protected]',
72
        ], $attributes);
73
74
        return \Backpack\CRUD\Tests\config\Models\User::make($attributes);
75
    }
76
77
    // allow us to run crud panel private/protected methods like `inferFieldTypeFromDbColumnType`
78
    public function invokeMethod(&$object, $methodName, array $parameters = [])
79
    {
80
        $reflection = new \ReflectionClass(get_class($object));
81
        $method = $reflection->getMethod($methodName);
82
        $method->setAccessible(true);
83
84
        return $method->invokeArgs($object, $parameters);
85
    }
86
}
87