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 — v6 (#4971)
by Pedro
29:14 queued 14:37
created

BaseDBCrudPanel::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 8
nc 1
nop 0
dl 0
loc 14
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Backpack\CRUD\Tests\Config\CrudPanel;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
6
use Illuminate\Foundation\Testing\RefreshDatabase;
7
8
abstract class BaseDBCrudPanel extends BaseCrudPanel
9
{
10
    use RefreshDatabase;
0 ignored issues
show
introduced by
The trait Illuminate\Foundation\Testing\RefreshDatabase requires some properties which are not provided by Backpack\CRUD\Tests\Conf...udPanel\BaseDBCrudPanel: $seeder, $seed, $connectionsToTransact, $dropTypes, $dropViews
Loading history...
11
12
    /**
13
     * @var CrudPanel
14
     */
15
    protected $crudPanel;
16
17
    protected $model;
18
19
    /**
20
     * Setup the test environment.
21
     *
22
     * @return void
23
     */
24
    protected function setUp(): void
25
    {
26
        parent::setUp();
27
28
        // call migrations specific to our tests
29
        $this->loadMigrationsFrom([
30
            '--database' => 'testing',
31
            '--path'     => realpath(__DIR__.'/../../config/database/migrations'),
32
        ]);
33
34
        $this->seed('Backpack\CRUD\Tests\config\database\seeds\UsersRolesTableSeeder');
35
        $this->seed('Backpack\CRUD\Tests\config\database\seeds\UsersTableSeeder');
36
        $this->seed('Backpack\CRUD\Tests\config\database\seeds\ArticlesTableSeeder');
37
        $this->seed('Backpack\CRUD\Tests\config\database\seeds\MorphableSeeders');
38
    }
39
40
    /**
41
     * Define environment setup.
42
     *
43
     * @param  \Illuminate\Foundation\Application  $app
44
     * @return void
45
     */
46
    protected function getEnvironmentSetUp($app)
47
    {
48
        $app['config']->set('database.default', 'testing');
49
    }
50
51
    /**
52
     * Assert that the attributes of a model entry are equal to the expected array of attributes.
53
     *
54
     * @param  array  $expected  attributes
55
     * @param  \Illuminate\Database\Eloquent\Model  $actual  model
56
     */
57
    protected function assertEntryEquals($expected, $actual)
58
    {
59
        foreach ($expected as $key => $value) {
60
            if (is_array($value)) {
61
                $this->assertEquals(count($value), $actual->{$key}->count());
62
            } else {
63
                $this->assertEquals($value, $actual->{$key});
64
            }
65
        }
66
67
        $this->assertNotNull($actual->created_at);
68
        $this->assertNotNull($actual->updated_at);
69
    }
70
}
71