for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Install GitHub App
<?php
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
use Backpack\CRUD\Tests\config\CrudPanel\BaseDBCrudPanel;
use Backpack\CRUD\Tests\config\Models\Reorder;
use Illuminate\Support\Facades\DB;
/**
* @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Reorder
*/
class CrudPanelReorderOperationTest extends BaseDBCrudPanel
{
public function testSaveReorderTree()
$this->createReorderItems();
$this->crudPanel->setModel(Reorder::class);
$this->crudPanel->updateTreeOrder(
[
'item_id' => 1,
'parent_id' => null,
'depth' => 1,
'left' => 2,
'right' => 7,
],
'item_id' => 2,
'parent_id' => 1,
'depth' => 2,
'left' => 3,
'right' => 4,
'item_id' => 3,
'left' => 5,
'right' => 6,
]
);
$this->assertDatabaseHas('reorders', [
'id' => 1,
'lft' => 2,
'rgt' => 7,
]);
}
private function createReorderItems()
DB::table('reorders')->insert([
'name' => 'Item 1',
'lft' => null,
'rgt' => null,
'depth' => null,
'id' => 2,
'name' => 'Item 2',
'id' => 3,
'name' => 'Item 3',