@@ -17,6 +17,7 @@ public function testNoValidation(): void
17
17
$ testCell = $ sheet ->getCell ('A1 ' );
18
18
19
19
self ::assertTrue ($ testCell ->hasValidValue (), 'a cell without any validation data is always valid ' );
20
+ $ spreadsheet ->disconnectWorksheets ();
20
21
}
21
22
22
23
public function testUnsupportedType (): void
@@ -30,6 +31,7 @@ public function testUnsupportedType(): void
30
31
$ validation ->setAllowBlank (true );
31
32
32
33
self ::assertFalse ($ testCell ->hasValidValue (), 'cannot assert that value is valid when the validation type is not supported ' );
34
+ $ spreadsheet ->disconnectWorksheets ();
33
35
}
34
36
35
37
public function testList (): void
@@ -71,5 +73,24 @@ public function testList(): void
71
73
$ validation ->setFormula1 ('broken : cell : coordinates ' );
72
74
73
75
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 ();
74
95
}
75
96
}
0 commit comments