We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
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
![]() |
|||
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 | * Assert that the attributes of a model entry are equal to the expected array of attributes. |
||
42 | * |
||
43 | * @param array $expected attributes |
||
44 | * @param \Illuminate\Database\Eloquent\Model $actual model |
||
45 | */ |
||
46 | protected function assertEntryEquals($expected, $actual) |
||
47 | { |
||
48 | foreach ($expected as $key => $value) { |
||
49 | if (is_array($value)) { |
||
50 | $this->assertEquals(count($value), $actual->{$key}->count()); |
||
51 | } else { |
||
52 | $this->assertEquals($value, $actual->{$key}); |
||
53 | } |
||
54 | } |
||
55 | |||
56 | $this->assertNotNull($actual->created_at); |
||
57 | $this->assertNotNull($actual->updated_at); |
||
58 | } |
||
59 | } |
||
60 |