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
Push — master ( 781044...c057f4 )
by Cristian
13:54 queued 15s
created

BasePrefixedDBCrudPanelTest::assertEntryEquals()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 3
eloc 7
c 1
b 0
f 1
nc 3
nop 2
dl 0
loc 12
rs 10
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
use Illuminate\Support\Facades\DB;
8
9
abstract class BasePrefixedDBCrudPanelTest extends BaseCrudPanelTest
10
{
11
    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...PrefixedDBCrudPanelTest: $seeder, $seed, $connectionsToTransact, $dropTypes, $dropViews
Loading history...
12
13
    /**
14
     * @var CrudPanel
15
     */
16
    protected $crudPanel;
17
18
    protected $model;
19
20
    /**
21
     * Setup the test environment.
22
     *
23
     * @return void
24
     */
25
    protected function setUp(): void
26
    {
27
        parent::setUp();
28
29
        DB::connection('testing')->getSchemaGrammar()->setTablePrefix('test_');
30
        // call migrations specific to our tests
31
        $this->loadMigrationsFrom([
32
            '--database' => 'testing',
33
            '--path' => realpath(__DIR__.'/../../config/database/migrations'),
34
        ]);
35
36
        $this->artisan('db:seed', ['--class' => 'Backpack\CRUD\Tests\Config\Database\Seeds\UsersRolesTableSeeder']);
37
        $this->artisan('db:seed', ['--class' => 'Backpack\CRUD\Tests\Config\Database\Seeds\UsersTableSeeder']);
38
        $this->artisan('db:seed', ['--class' => 'Backpack\CRUD\Tests\Config\Database\Seeds\ArticlesTableSeeder']);
39
    }
40
41
    /**
42
     * Define environment setup.
43
     *
44
     * @param \Illuminate\Foundation\Application $app
45
     *
46
     * @return void
47
     */
48
    protected function getEnvironmentSetUp($app)
49
    {
50
        $app['config']->set('database.default', 'testing');
51
        DB::connection('testing')->setTablePrefix('test_');
52
    }
53
54
    protected function defineDatabaseMigrations()
55
    {
56
        DB::connection('testing')->getSchemaGrammar()->setTablePrefix('test_');
57
        $this->artisan('migrate', ['--database' => 'testing']);
58
    }
59
60
    /**
61
     * Assert that the attributes of a model entry are equal to the expected array of attributes.
62
     *
63
     * @param array                               $expected attributes
64
     * @param \Illuminate\Database\Eloquent\Model $actual   model
65
     */
66
    protected function assertEntryEquals($expected, $actual)
67
    {
68
        foreach ($expected as $key => $value) {
69
            if (is_array($value)) {
70
                $this->assertEquals(count($value), $actual->{$key}->count());
71
            } else {
72
                $this->assertEquals($value, $actual->{$key});
73
            }
74
        }
75
76
        $this->assertNotNull($actual->created_at);
77
        $this->assertNotNull($actual->updated_at);
78
    }
79
}
80