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 — master (#3476)
by Cristian
15:13
created

BaseDBCrudPanelTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 61
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 19
dl 0
loc 61
rs 10
c 1
b 0
f 0
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getEnvironmentSetUp() 0 3 1
A setUp() 0 13 1
A assertEntryEquals() 0 12 3
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudPanel;
6
use Illuminate\Foundation\Testing\RefreshDatabase;
7
8
abstract class BaseDBCrudPanelTest extends BaseCrudPanelTest
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\Unit...nel\BaseDBCrudPanelTest: $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->artisan('db:seed', ['--class' => 'Backpack\CRUD\Tests\Config\Database\Seeds\UsersRolesTableSeeder']);
35
        $this->artisan('db:seed', ['--class' => 'Backpack\CRUD\Tests\Config\Database\Seeds\UsersTableSeeder']);
36
        $this->artisan('db:seed', ['--class' => 'Backpack\CRUD\Tests\Config\Database\Seeds\ArticlesTableSeeder']);
37
    }
38
39
    /**
40
     * Define environment setup.
41
     *
42
     * @param \Illuminate\Foundation\Application $app
43
     *
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