File tree Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Expand file tree Collapse file tree 3 files changed +66
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ function backpack_form_input()
6161 // regular fields don't need any aditional parsing
6262 if (strpos ($ row ['name ' ], '[ ' ) === false ) {
6363 $ result [$ row ['name ' ]] = $ row ['value ' ];
64+
6465 continue ;
6566 }
6667
@@ -87,6 +88,7 @@ function backpack_form_input()
8788
8889 if (isset ($ repeatableRowKey )) {
8990 $ result [$ parentInputName ][$ repeatableRowKey ][$ inputName ] = $ row ['value ' ];
91+
9092 continue ;
9193 }
9294
@@ -306,6 +308,9 @@ function is_multidimensional_array(array $array)
306308 */
307309 function backpack_pro ()
308310 {
311+ if (app ()->runningUnitTests ()) {
312+ return true ;
313+ }
309314 if (! \Composer \InstalledVersions::isInstalled ('backpack/pro ' )) {
310315 return false ;
311316 }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Backpack \CRUD \Tests \Unit \CrudPanel ;
4+
5+ /**
6+ * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Filters
7+ */
8+ class CrudPanelFiltersTest extends BaseCrudPanelTest
9+ {
10+ protected $ testFilter = [[
11+ 'name ' => 'my_filter ' ,
12+ 'label ' => 'filter label ' ,
13+ ], false , false , false ];
14+
15+ public function testItEnablesTheFiltersButConsiderThemDisableIfEmpty ()
16+ {
17+ $ this ->crudPanel ->enableFilters ();
18+ $ this ->assertFalse ($ this ->crudPanel ->filtersEnabled ());
19+ }
20+
21+ public function testItCanAddFiltersToCrudPanel ()
22+ {
23+ $ this ->crudPanel ->addFilter (...$ this ->testFilter );
24+
25+ $ this ->assertCount (1 , $ this ->crudPanel ->filters ());
26+ }
27+
28+ public function testItCanClearFilters ()
29+ {
30+ $ this ->crudPanel ->addFilter (...$ this ->testFilter );
31+
32+ $ this ->crudPanel ->clearFilters ();
33+ $ this ->assertCount (0 , $ this ->crudPanel ->filters ());
34+ }
35+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Backpack \CRUD \Tests \Unit \CrudPanel ;
4+
5+ /**
6+ * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Operations
7+ */
8+ class CrudPanelOperationsTest extends BaseCrudPanelTest
9+ {
10+ public function testItCanSetAndGetTheCurrentOperation ()
11+ {
12+ $ this ->crudPanel ->setOperation ('create ' );
13+ $ operation = $ this ->crudPanel ->getOperation ();
14+ $ this ->assertEquals ('create ' , $ operation );
15+ }
16+
17+ public function testItCanConfigureOperations ()
18+ {
19+ $ this ->crudPanel ->operation (['create ' , 'update ' ], function () {
20+ $ this ->crudPanel ->addField (['name ' => 'test ' , 'type ' => 'text ' ]);
21+ });
22+ $ this ->crudPanel ->applyConfigurationFromSettings ('create ' );
23+
24+ $ this ->assertEquals (count ($ this ->crudPanel ->fields ()), 1 );
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments