File tree Expand file tree Collapse file tree 4 files changed +27
-5
lines changed
Expand file tree Collapse file tree 4 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -528,12 +528,12 @@ public function getData()
528528 $ result = [];
529529
530530 $ hasValue = false ;
531- if ($ this ->data ['from ' ] != $ this ::DEFAULT_VALUE ) {
531+ if (isset ( $ this -> data [ ' from ' ]) && $ this ->data ['from ' ] != $ this ::DEFAULT_VALUE ) {
532532 $ result ['from ' ] = $ this ->data ['from ' ];
533533 $ hasValue = true ;
534534 }
535535
536- if ($ this ->data ['to ' ] != $ this ::DEFAULT_VALUE ) {
536+ if (isset ( $ this -> data [ ' to ' ]) && $ this ->data ['to ' ] != $ this ::DEFAULT_VALUE ) {
537537 $ result ['to ' ] = $ this ->data ['to ' ];
538538 $ hasValue = true ;
539539 }
@@ -687,7 +687,7 @@ public function getFilters($source)
687687 {
688688 $ filters = [];
689689
690- if ($ this ->hasOperator ($ this ->data ['operator ' ])) {
690+ if (isset ( $ this -> data ) && $ this ->hasOperator ($ this ->data ['operator ' ])) {
691691 if ($ this instanceof ArrayColumn && in_array ($ this ->data ['operator ' ], [self ::OPERATOR_EQ , self ::OPERATOR_NEQ ])) {
692692 $ filters [] = new Filter ($ this ->data ['operator ' ], $ this ->data ['from ' ]);
693693 } else {
Original file line number Diff line number Diff line change @@ -677,6 +677,28 @@ public function testGetEmptyDataIfOperatorNotNotNullOrNullNoFromToValues()
677677 }
678678 }
679679
680+ public function testGetNullData ()
681+ {
682+ $ mock = $ this ->getMockForAbstractClass (Column::class);
683+
684+ try {
685+ $ mock ->getData ();
686+ } catch (\Exception $ exception ) {
687+ $ this ->fail ($ exception ->getMessage ());
688+ }
689+ }
690+
691+ public function testGetFiltersWithoutData ()
692+ {
693+ $ mock = $ this ->getMockForAbstractClass (Column::class);
694+
695+ try {
696+ $ mock ->getFilters ('aSource ' );
697+ } catch (\Exception $ exception ) {
698+ $ this ->fail ($ exception ->getMessage ());
699+ }
700+ }
701+
680702 public function testGetData ()
681703 {
682704 $ mock = $ this ->getMockForAbstractClass (Column::class);
Original file line number Diff line number Diff line change 55use APY \DataGridBundle \Grid \Column \Column ;
66use APY \DataGridBundle \Grid \Column \TextColumn ;
77use APY \DataGridBundle \Grid \Filter ;
8- use Symfony \ Bundle \ FrameworkBundle \ Tests \TestCase ;
8+ use PHPUnit \ Framework \TestCase ;
99
1010class TextColumnTest extends TestCase
1111{
Original file line number Diff line number Diff line change 1919use APY \DataGridBundle \Grid \Source \Entity ;
2020use APY \DataGridBundle \Grid \Source \Source ;
2121use Symfony \Bundle \FrameworkBundle \Templating \EngineInterface ;
22- use Symfony \ Bundle \ FrameworkBundle \ Tests \TestCase ;
22+ use PHPUnit \ Framework \TestCase ;
2323use Symfony \Component \DependencyInjection \Container ;
2424use Symfony \Component \HttpFoundation \HeaderBag ;
2525use Symfony \Component \HttpFoundation \ParameterBag ;
You can’t perform that action at this time.
0 commit comments