| 1 |  |  | <?php | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | namespace Backpack\CRUD\Tests\Unit\CrudPanel; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | use Backpack\CRUD\Tests\Unit\Models\Article; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | use Backpack\CRUD\Tests\Unit\Models\Role; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | use Backpack\CRUD\Tests\Unit\Models\User; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  | use Illuminate\Database\Eloquent\ModelNotFoundException; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | use Illuminate\Support\Collection; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | use Illuminate\Support\Facades\DB; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | class CrudPanelReadTest extends BaseDBCrudPanelTest | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  |     private $relationshipColumn = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  |         'name'      => 'user_id', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  |         'type'      => 'select', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  |         'entity'    => 'user', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  |         'attribute' => 'name', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  |     private $relationshipMultipleColumn = [ | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  |         'name'      => 'roles', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  |         'type'      => 'select', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  |         'entity'    => 'roles', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  |         'attribute' => 'name', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  |         'model' => Role::class, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  |     private $nonRelationshipColumn = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  |         'name'  => 'field1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  |         'label' => 'Field1', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  |     private $articleFieldsArray = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  |         [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  |             'name'  => 'content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  |             'label' => 'The Content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  |         [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  |             'name'  => 'metas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  |             'label' => 'Metas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  |         [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  |             'name' => 'tags', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  |         [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |             'name' => 'extras', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  |     private $expectedCreateFormArticleFieldsArray = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  |         'content' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  |             'name'  => 'content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  |             'label' => 'The Content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  |         'metas' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  |             'name'  => 'metas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  |             'label' => 'Metas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |         'tags' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  |             'name'  => 'tags', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  |             'label' => 'Tags', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  |         'extras' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  |             'name'  => 'extras', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  |             'label' => 'Extras', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  |     private $expectedUpdateFormArticleFieldsArray = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  |         'content' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |             'name'  => 'content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  |             'label' => 'The Content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  |             'value' => 'Some Content', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  |         'metas' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  |             'name'  => 'metas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  |             'label' => 'Metas', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  |             'value' => '{"meta_title":"Meta Title Value","meta_description":"Meta Description Value"}', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  |         'tags' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  |             'name'  => 'tags', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  |             'label' => 'Tags', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  |             'value' => '{"tags":["tag1","tag2","tag3"]}', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  |         'extras' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  |             'name'  => 'extras', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  |             'label' => 'Extras', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  |             'type'  => 'text', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  |             'value' => '{"extra_details":["detail1","detail2","detail3"]}', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  |         'id' => [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  |             'name'  => 'id', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |             'type'  => 'hidden', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  |             'value' => 1, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  |         ], | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  |     private $uploadField = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  |         'name'   => 'image', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  |         'label'  => 'Image', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  |         'type'   => 'upload', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  |         'upload' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  |     private $multipleUploadField = [ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  |         'name'   => 'photos', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  |         'label'  => 'Photos', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  |         'type'   => 'upload_multiple', | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  |         'upload' => true, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  |     ]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  |     private $defaultPaginator = [[10, 20, 30], ['t1', 't2', 't3']]; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  |     public function testGetEntry() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  |         $user = User::find(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  |         $entry = $this->crudPanel->getEntry($user->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  |         $this->assertEquals($user, $entry); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  |     public function testGetEntryWithFakes() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  |         $this->markTestIncomplete('Not correctly implemented'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  |         $article = Article::find(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  |         $entry = $this->crudPanel->getEntry($article->id); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  |         // TODO: the withFakes call is needed for this to work. the state of the model should not be changed by the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  |         //       getEntry method. the transformation of the fakes columns should be kept in a different crud panel | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |         //       attribute or, at most, the getEntry method should be renamed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  |         $article->withFakes(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  |         $this->assertEquals($article, $entry); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  |     public function testGetEntryExists() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |         $userEntry = $this->crudPanel->getEntry(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  |         $this->assertInstanceOf(User::class, $userEntry); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  |         $articleEntry = $this->crudPanel->getEntry(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  |         $this->assertInstanceOf(Article::class, $articleEntry); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  |     public function testGetEntryUnknownId() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |         $this->expectException(ModelNotFoundException::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  |         $unknownId = DB::getPdo()->lastInsertId() + 2; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  |         $this->crudPanel->getEntry($unknownId); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  |     public function testAutoEagerLoadRelationshipColumns() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  |         $this->crudPanel->addColumn($this->relationshipColumn); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |         $this->crudPanel->autoEagerLoadRelationshipColumns(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  |         $this->assertArrayHasKey('user', $this->crudPanel->query->getEagerLoads()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  |     public function testAutoEagerLoadRelationshipColumnsNoRelationships() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  |         $this->crudPanel->addColumn($this->nonRelationshipColumn); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |         $this->crudPanel->autoEagerLoadRelationshipColumns(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  |         $this->assertEmpty($this->crudPanel->query->getEagerLoads()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  |     public function testGetEntries() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  |         $entries = $this->crudPanel->getEntries(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  |         $this->assertInstanceOf(Collection::class, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  |         $this->assertEquals(2, $entries->count()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |         $this->assertEquals(User::find(1), $entries->first()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  |     public function testGetEntriesWithFakes() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  |         $this->markTestIncomplete('Not correctly implemented'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  |         $entries = $this->crudPanel->getEntries(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  |         // TODO: the getEntries method automatically adds fakes. the state of the models should not be changed by the | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  |         //       getEntries method. at most, the getEntries method should be renamed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  |         $this->assertInstanceOf(Collection::class, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  |         $this->assertEquals(1, $entries->count()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  |         $this->assertEquals(Article::find(1), $entries->first()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  |     public function testGetFieldsCreateForm() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  |         $this->crudPanel->addFields($this->articleFieldsArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  |         // TODO: update method documentation. the $form parameter does not default to 'both'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 |  |  |         $fields = $this->crudPanel->getFields('create'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 |  |  |         $this->assertEquals($this->expectedCreateFormArticleFieldsArray, $fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |     public function testGetFieldsUpdateForm() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  |         $this->crudPanel->setOperation('update'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |         $this->crudPanel->addFields($this->articleFieldsArray); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 |  |  |         // TODO: update method documentation. the $form parameter does not default to 'both'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 |  |  |         $fields = $this->crudPanel->getUpdateFields(1); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |         $this->assertEquals($this->expectedUpdateFormArticleFieldsArray, $fields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  |     public function testHasUploadFieldsCreateForm() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 |  |  |         $this->crudPanel->addField($this->uploadField, 'create'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |         // TODO: update method documentation. the $form parameter does not default to 'both'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  |         $hasUploadFields = $this->crudPanel->hasUploadFields('create'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  |         $this->assertTrue($hasUploadFields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 |  |  |     public function testHasMultipleUploadFieldsCreateForm() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  |         $this->crudPanel->addField($this->multipleUploadField, 'create'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 |  |  |         // TODO: update method documentation. the $form parameter does not default to 'both'. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 |  |  |         $hasMultipleUploadFields = $this->crudPanel->hasUploadFields('create'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  |         $this->assertTrue($hasMultipleUploadFields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 262 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 263 |  |  |     public function testHasUploadFieldsUpdateForm() | 
            
                                                                        
                            
            
                                    
            
            
                | 264 |  |  |     { | 
            
                                                                        
                            
            
                                    
            
            
                | 265 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                        
                            
            
                                    
            
            
                | 266 |  |  |         $this->crudPanel->addField($this->uploadField, 'update'); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 267 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 268 |  |  |         // TODO: update method documentation. the $form parameter does not default to 'both'. | 
            
                                                                        
                            
            
                                    
            
            
                | 269 |  |  |         $hasUploadFields = $this->crudPanel->hasUploadFields('update', 1); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                        
                            
            
                                    
            
            
                | 270 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 271 |  |  |         $this->assertTrue($hasUploadFields); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  |     public function testEnableDetailsRow() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  |         $this->crudPanel->setOperation('create'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 |  |  |         $this->crudPanel->enableDetailsRow(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 |  |  |         $this->assertTrue($this->crudPanel->getOperationSetting('detailsRow')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  |     public function testDisableDetailsRow() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 |  |  |         $this->crudPanel->disableDetailsRow(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  |         $this->assertFalse($this->crudPanel->get('list.detailsRow')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 |  |  |     public function testSetDefaultPageLength() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |         $pageLength = 20; | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 |  |  |         $this->crudPanel->setDefaultPageLength($pageLength); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |         $this->assertEquals($pageLength, $this->crudPanel->getDefaultPageLength()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  |     public function testGetDefaultPageLength() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |         $defaultPageLength = $this->crudPanel->getDefaultPageLength(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 |  |  |         $this->assertEquals(25, $defaultPageLength); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |     public function testEnableExportButtons() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 |  |  |         $this->crudPanel->enableExportButtons(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  |         $this->assertTrue($this->crudPanel->exportButtons()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  |     public function testGetExportButtons() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |         $exportButtons = $this->crudPanel->exportButtons(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  |         $this->assertFalse($exportButtons); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  |     public function testGetRelatedEntriesAttributesFromBelongsToMany() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 |  |  |         $user = $this->crudPanel->getModel()->where('id', 2)->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($user, 'roles', 'name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  |         $this->assertEquals([1 => 'admin', 2 => 'user'], $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 |  |  |     public function testGetRelatedEntriesAttributesFromBelongsToManyWithAcessor() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 |  |  |         $user = $this->crudPanel->getModel()->where('id', 2)->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($user, 'roles', 'role_name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 |  |  |         $this->assertEquals([1 => 'admin++', 2 => 'user++'], $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 |  |  |     public function testGetRelatedEntriesAttributesFromHasMany() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 |  |  |         $user = $this->crudPanel->getModel()->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($user, 'articles', 'content'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |         $this->assertCount(1, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  |     public function testGetRelatedEntriesAttributesFromHasManyWithAcessor() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 |  |  |         $user = $this->crudPanel->getModel()->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($user, 'articles', 'content_composed'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  |         $this->assertCount(1, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 |  |  |     public function testGetRelatedEntriesAttributesFromBelongsTo() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 |  |  |         $article = $this->crudPanel->getModel()->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($article, 'user', 'name'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  |         $this->assertCount(1, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  |     public function testGetRelatedEntriesAttributesFromBelongsToWithAcessor() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  |         $this->crudPanel->setModel(Article::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  |         $article = $this->crudPanel->getModel()->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($article, 'user', 'name_composed'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  |         $this->assertCount(1, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 |  |  |     public function testGetRelatedEntriesAttributesFromHasOne() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |         $user = $this->crudPanel->getModel()->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($user, 'accountDetails', 'nickname'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 |  |  |         $this->assertCount(1, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 |  |  |     public function testGetRelatedEntriesAttributesFromHasOneWithAcessor() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |         $user = $this->crudPanel->getModel()->first(); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 |  |  |         $entries = $this->crudPanel->getRelatedEntriesAttributes($user, 'accountDetails', 'nickname_composed'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  |         $this->assertCount(1, $entries); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  |      * Tests define paginator length with single array [20, 30, 40]. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |     public function testCrudPanelChangePaginatorLengthSingleArrayNoLabels() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  |         $this->crudPanel->setPageLengthMenu([20, 30, 40]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[1])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |      * Tests define paginator length with single array [20 => 'v', 30 => 't', 40 => 'q']. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 |  |  |     public function testCrudPanelChangePaginatorLengthSingleArrayWithLabels() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  |         $this->crudPanel->setPageLengthMenu([20 => 'v', 30 => 't', 40 => 'q']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  |         $this->assertEquals($this->crudPanel->getOperationSetting('pageLengthMenu')[1], ['v', 't', 'q']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  |      * Tests define paginator length with and 'all' options as -1 as defined in previous versions of BP | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |     public function testCrudPanelPaginatorWithAllAsOption() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 428 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 429 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 430 |  |  |         $this->crudPanel->setPageLengthMenu([-1 => 'All']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 431 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 432 |  |  |         $this->assertTrue(in_array(-1, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 433 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 434 |  |  |         $this->crudPanel->setPageLengthMenu([-1]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 435 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 436 |  |  |         $this->assertTrue(in_array(-1, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 437 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 438 |  |  |         $this->crudPanel->setPageLengthMenu(-1); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 439 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 440 |  |  |         $this->assertTrue(in_array(-1, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 441 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 442 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 443 |  |  |      /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 444 |  |  |      * Tests define paginator length with and 'all' options as -1 as defined in previous versions of BP | 
            
                                                                                                            
                            
            
                                    
            
            
                | 445 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 446 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 447 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 448 |  |  |     public function testCrudPanelPaginatorWithZeroAsOption() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 449 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 450 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 451 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 452 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 453 |  |  |         $this->crudPanel->setPageLengthMenu([0 => 'v', 30 => 't', 40 => 'q']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  |         $this->assertTrue(in_array(0, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  |         $this->assertTrue(in_array('v', $this->crudPanel->getOperationSetting('pageLengthMenu')[1])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 |  |  |         $this->crudPanel->setPageLengthMenu([0 => 'All']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 |  |  |         $this->assertTrue(in_array(0, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |         $this->crudPanel->setPageLengthMenu([0 => 'All', ]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 |  |  |         $this->assertTrue(in_array(0, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  |         $this->crudPanel->setPageLengthMenu([0]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 |  |  |         $this->assertTrue(in_array(0, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  |      * Tests define paginator length with multi array [[20, 30, 40],['v', 't', 'q']]. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 |  |  |      * @group failing | 
            
                                                                                                            
                            
            
                                    
            
            
                | 480 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 481 |  |  |     public function testCrudPanelChangePaginatorLengthMultiArrayWithLabels() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 482 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 483 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 484 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 485 |  |  |         $this->crudPanel->setPageLengthMenu([[20, 30, 40], ['v', 't', 'q']]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 486 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 487 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 488 |  |  |         $this->assertEquals($this->crudPanel->getOperationSetting('pageLengthMenu')[1], ['v', 't', 'q']); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 489 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 490 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 491 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 492 |  |  |      * Tests define paginator length with multi array [[20, 30, 40]]. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 493 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 494 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 495 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 496 |  |  |     public function testCrudPanelChangePaginatorLengthMultiArrayNoLabels() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 497 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 498 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 499 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 500 |  |  |         $this->crudPanel->setPageLengthMenu([[20, 30, 40]]); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 501 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 502 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 503 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[1])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 504 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 505 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 506 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 507 |  |  |      * Tests define paginator length with single value 40. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 508 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 509 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 510 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 511 |  |  |     public function testCrudPanelChangePaginatorLengthWithSingleValue() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 512 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 513 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 514 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 515 |  |  |         $this->crudPanel->setPageLengthMenu(40); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 516 |  |  |         $this->assertCount(2, $this->crudPanel->getOperationSetting('pageLengthMenu')); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 517 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 518 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[1])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 519 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 520 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 521 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 522 |  |  |      * Tests if table paginator adds default option non-existent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 523 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 524 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 525 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 526 |  |  |     public function testCrudPanelPaginatorAddsDefaultOptionNonExistent() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 527 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 528 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 529 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 530 |  |  |         $this->crudPanel->setPageLengthMenu(40); | 
                            
                    |  |  |  | 
                                                                                        
                                                                                     | 
            
                                                                                                            
                            
            
                                    
            
            
                | 531 |  |  |         $this->crudPanel->setDefaultPageLength(40); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 532 |  |  |         $this->assertCount(2, $this->crudPanel->getPageLengthMenu()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 533 |  |  |         $this->assertTrue(in_array(40, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 534 |  |  |         $this->assertEquals(array_values($this->crudPanel->getPageLengthMenu()[0])[0], 40); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 535 |  |  |     } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 536 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 537 |  |  |     /** | 
            
                                                                                                            
                            
            
                                    
            
            
                | 538 |  |  |      * Tests if table paginator adds default option existent. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 539 |  |  |      * | 
            
                                                                                                            
                            
            
                                    
            
            
                | 540 |  |  |      * @group | 
            
                                                                                                            
                            
            
                                    
            
            
                | 541 |  |  |      */ | 
            
                                                                                                            
                            
            
                                    
            
            
                | 542 |  |  |     public function testCrudPanelPaginatorAddsDefaultOptionExistent() | 
            
                                                                                                            
                            
            
                                    
            
            
                | 543 |  |  |     { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 544 |  |  |         $this->crudPanel->setModel(User::class); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 545 |  |  |         $this->crudPanel->setOperation('list'); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 546 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 547 |  |  |         $this->crudPanel->setPageLengthMenu($this->defaultPaginator); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 548 |  |  |         $this->crudPanel->setDefaultPageLength(20); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 549 |  |  |         $this->assertCount(2, $this->crudPanel->getPageLengthMenu()); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 550 |  |  |         $this->assertTrue(in_array(10, $this->crudPanel->getOperationSetting('pageLengthMenu')[0])); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 551 |  |  |         $this->assertEquals(array_values($this->crudPanel->getPageLengthMenu()[0])[0], 20); | 
            
                                                                                                            
                            
            
                                    
            
            
                | 552 |  |  |     } | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 553 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 554 |  |  |  |