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 (#5586)
by Pedro
22:38 queued 07:37
created

CrudPanelReorderOperationTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 68
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 44
c 1
b 0
f 1
dl 0
loc 68
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testSaveReorderTree() 0 37 1
A createReorderItems() 0 26 1
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Backpack\CRUD\Tests\config\CrudPanel\BaseDBCrudPanel;
6
use Backpack\CRUD\Tests\config\Models\Reorder;
7
use Illuminate\Support\Facades\DB;
8
9
/**
10
 * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Reorder
11
 */
12
class CrudPanelReorderOperationTest extends BaseDBCrudPanel
13
{
14
    public function testSaveReorderTree()
15
    {
16
        $this->createReorderItems();
17
        $this->crudPanel->setModel(Reorder::class);
18
19
        $this->crudPanel->updateTreeOrder(
20
            [
21
                [
22
                    'item_id' => 1,
23
                    'parent_id' => null,
24
                    'depth' => 1,
25
                    'left' => 2,
26
                    'right' => 7,
27
                ],
28
                [
29
                    'item_id' => 2,
30
                    'parent_id' => 1,
31
                    'depth' => 2,
32
                    'left' => 3,
33
                    'right' => 4,
34
                ],
35
                [
36
                    'item_id' => 3,
37
                    'parent_id' => 1,
38
                    'depth' => 2,
39
                    'left' => 5,
40
                    'right' => 6,
41
                ],
42
            ]
43
        );
44
45
        $this->assertDatabaseHas('reorders', [
46
            'id' => 1,
47
            'parent_id' => null,
48
            'lft' => 2,
49
            'rgt' => 7,
50
            'depth' => 1,
51
        ]);
52
    }
53
54
    private function createReorderItems()
55
    {
56
        DB::table('reorders')->insert([
57
            [
58
                'id' => 1,
59
                'name' => 'Item 1',
60
                'parent_id' => null,
61
                'lft' => null,
62
                'rgt' => null,
63
                'depth' => null,
64
            ],
65
            [
66
                'id' => 2,
67
                'name' => 'Item 2',
68
                'parent_id' => null,
69
                'lft' => null,
70
                'rgt' => null,
71
                'depth' => null,
72
            ],
73
            [
74
                'id' => 3,
75
                'name' => 'Item 3',
76
                'parent_id' => null,
77
                'lft' => null,
78
                'rgt' => null,
79
                'depth' => null,
80
            ],
81
        ]);
82
    }
83
}
84