File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,9 @@ public function deserializeValue($value) {
71
71
if ($ this ->uploadData === null ) {
72
72
$ this ->uploadData = [];
73
73
}
74
- if (count ($ this ->uploadData ) === 0 ) {
74
+ $ this ->value = __ ('No attached document ' , 'formcreator ' );;
75
+ if (count ($ this ->uploadData ) > 0 ) {
75
76
$ this ->value = __ ('Attached document ' , 'formcreator ' );
76
- } else {
77
- $ this ->value = '' ;
78
77
}
79
78
}
80
79
Original file line number Diff line number Diff line change @@ -39,4 +39,23 @@ public function testIsPrerequisites() {
39
39
$ output = $ instance ->isPrerequisites ();
40
40
$ this ->boolean ($ output )->isEqualTo (true );
41
41
}
42
+
43
+ public function testDeserializeValue () {
44
+ $ instance = $ this ->newTestedInstance ([]);
45
+ $ instance ->deserializeValue ('invalid Json ' );
46
+ $ this ->string ($ instance ->getValueForTargetText (true ))
47
+ ->isEqualTo ('No attached document ' );
48
+
49
+ $ instance ->deserializeValue ('[] ' );
50
+ $ this ->string ($ instance ->getValueForTargetText (true ))
51
+ ->isEqualTo ('No attached document ' );
52
+
53
+ $ instance ->deserializeValue ('[1] ' );
54
+ $ this ->string ($ instance ->getValueForTargetText (true ))
55
+ ->isEqualTo ('Attached document ' );
56
+
57
+ $ instance ->deserializeValue ('[1,2] ' );
58
+ $ this ->string ($ instance ->getValueForTargetText (true ))
59
+ ->isEqualTo ('Attached document ' );
60
+ }
42
61
}
You can’t perform that action at this time.
0 commit comments