@@ -6,10 +6,15 @@ class DataFieldsTest extends \PHPUnit\Framework\TestCase
6
6
public function testDataFieldParsing ()
7
7
{
8
8
$ dataFields = new DataFields ($ this ->_testInput );
9
- //print_r($dataFields->__toArray());exit;
10
9
$ this ->assertEquals ($ this ->_parsedResult , $ dataFields ->__toArray ());
11
10
}
12
11
12
+ public function testParsingOfDataFieldWithWarning ()
13
+ {
14
+ $ dataFields = new DataFields ($ this ->_warningInput );
15
+ $ this ->assertEquals ($ this ->_parsedWarningResult , $ dataFields ->__toArray ());
16
+ }
17
+
13
18
protected $ _testInput = <<<DATA
14
19
---
15
20
FieldType: Text
@@ -59,6 +64,7 @@ public function testDataFieldParsing()
59
64
---more:colons:
60
65
and
61
66
multi lines
67
+ even indented
62
68
63
69
FieldJustification: Left
64
70
DATA ;
@@ -101,8 +107,46 @@ public function testDataFieldParsing()
101
107
'FieldNameAlt ' => 'field5_alt ' ,
102
108
'FieldFlags ' => 0 ,
103
109
'FieldValue ' => "field:with:colons \n\n---more:colons: \nand \nmulti lines \n" ,
104
- 'FieldValueDefault ' => "default:with:colons \n\n---more:colons: \nand \nmulti lines \n" ,
110
+ 'FieldValueDefault ' => "default:with:colons \n\n---more:colons: \nand \nmulti lines \n even indented \n " ,
105
111
'FieldJustification ' => 'Left ' ,
106
112
]
107
113
];
114
+
115
+ protected $ _warningInput = <<<DATA
116
+ WARNING: The creator of the input PDF:
117
+ example_pdf_with_password.pdf
118
+ has set an owner password (which is not required to handle this PDF).
119
+ You did not supply this password. Please respect any copyright.
120
+ ---
121
+ FieldType: Text
122
+ FieldName: field1
123
+ FieldNameAlt: field1_alt
124
+ FieldFlags: 0
125
+ FieldJustification: Left
126
+ ---
127
+ FieldType: Text
128
+ FieldName: field2
129
+ FieldNameAlt: field2_alt
130
+ FieldFlags: 0
131
+ FieldValue: value:with:colons
132
+ FieldJustification: Left
133
+ DATA ;
134
+
135
+ protected $ _parsedWarningResult = [
136
+ [
137
+ 'FieldType ' => 'Text ' ,
138
+ 'FieldName ' => 'field1 ' ,
139
+ 'FieldNameAlt ' => 'field1_alt ' ,
140
+ 'FieldFlags ' => 0 ,
141
+ 'FieldJustification ' => 'Left ' ,
142
+ ],
143
+ [
144
+ 'FieldType ' => 'Text ' ,
145
+ 'FieldName ' => 'field2 ' ,
146
+ 'FieldNameAlt ' => 'field2_alt ' ,
147
+ 'FieldFlags ' => 0 ,
148
+ 'FieldValue ' => 'value:with:colons ' ,
149
+ 'FieldJustification ' => 'Left ' ,
150
+ ],
151
+ ];
108
152
}
0 commit comments