@@ -17,6 +17,7 @@ public function testNoValidation(): void
1717 $ testCell = $ sheet ->getCell ('A1 ' );
1818
1919 self ::assertTrue ($ testCell ->hasValidValue (), 'a cell without any validation data is always valid ' );
20+ $ spreadsheet ->disconnectWorksheets ();
2021 }
2122
2223 public function testUnsupportedType (): void
@@ -30,6 +31,7 @@ public function testUnsupportedType(): void
3031 $ validation ->setAllowBlank (true );
3132
3233 self ::assertFalse ($ testCell ->hasValidValue (), 'cannot assert that value is valid when the validation type is not supported ' );
34+ $ spreadsheet ->disconnectWorksheets ();
3335 }
3436
3537 public function testList (): void
@@ -71,5 +73,24 @@ public function testList(): void
7173 $ validation ->setFormula1 ('broken : cell : coordinates ' );
7274
7375 self ::assertFalse ($ testCell ->hasValidValue (), 'invalid formula should not throw exceptions ' );
76+ $ spreadsheet ->disconnectWorksheets ();
77+ }
78+
79+ public function testInvalidNumeric (): void
80+ {
81+ $ spreadsheet = new Spreadsheet ();
82+ $ sheet = $ spreadsheet ->getActiveSheet ();
83+
84+ $ validation = $ sheet ->getCell ('A1 ' )->getDataValidation ();
85+ $ validation ->setType (DataValidation::TYPE_WHOLE )
86+ ->setOperator (DataValidation::OPERATOR_EQUAL )
87+ ->setFormula1 ('broken : cell : coordinates ' );
88+ $ sheet ->getCell ('A1 ' )->setValue (0 );
89+ self ::assertFalse ($ sheet ->getCell ('A1 ' )->hasValidValue (), 'invalid formula should return false ' );
90+ $ validation ->setOperator ('invalid operator ' )
91+ ->setFormula1 ('0 ' );
92+ self ::assertFalse ($ sheet ->getCell ('A1 ' )->hasValidValue (), 'invalid operator should return false ' );
93+
94+ $ spreadsheet ->disconnectWorksheets ();
7495 }
7596}
0 commit comments