@@ -175,15 +175,20 @@ public function testDoesNotPreserveVarsWhenFlagIsDisabled(
175
175
176
176
public function testKeepThePreviousStateOfOneViewComponentByDefault (): void
177
177
{
178
- $ this -> expectOutputString ( <<<'html'
178
+ $ html = <<<'html'
179
179
<div>Hi</div>
180
180
<div>Hi</div>
181
181
182
182
<input type="number" />
183
183
184
184
<input type="number" />
185
185
186
- html);
186
+ html;
187
+
188
+ // if windows replace \n with \r\n
189
+ $ html = str_replace ("\n" , PHP_EOL , $ html );
190
+
191
+ $ this ->expectOutputString ($ html );
187
192
188
193
$ this ->view ->render ('myComponent ' , ['prop ' => 'Hi ' ]);
189
194
$ this ->view ->render ('myComponent ' );
@@ -197,36 +202,46 @@ public function testKeepThePreviousStateOfDataSettedBySetMethod(): void
197
202
198
203
$ this ->view ->set ('prop ' , 'bar ' );
199
204
200
- $ this -> expectOutputString ( <<<'html'
205
+ $ html = <<<'html'
201
206
<div>qux</div>
202
207
<div>bar</div>
203
208
204
- html);
209
+ html;
210
+
211
+ // if windows replace \n with \r\n
212
+ $ html = str_replace ("\n" , PHP_EOL , $ html );
213
+
214
+ $ this ->expectOutputString ($ html );
205
215
206
216
$ this ->view ->render ('myComponent ' , ['prop ' => 'qux ' ]);
207
217
$ this ->view ->render ('myComponent ' );
208
218
}
209
219
210
220
public static function renderDataProvider (): array
211
221
{
212
- return [
213
- [
214
- <<<'html'
222
+ $ html1 = <<<'html'
215
223
<div>Hi</div>
216
224
<div></div>
217
225
218
- html,
219
- ['myComponent ' , ['prop ' => 'Hi ' ]],
220
- '/^Undefined variable:? \$?prop$/ '
221
- ],
222
- [
223
- <<<'html'
226
+ html;
227
+ $ html2 = <<<'html'
224
228
225
229
<input type="number" />
226
230
227
231
<input type="text" />
228
232
229
- html,
233
+ html;
234
+
235
+ $ html1 = str_replace ("\n" , PHP_EOL , $ html1 );
236
+ $ html2 = str_replace ("\n" , PHP_EOL , $ html2 );
237
+ return [
238
+ [
239
+ $ html1 ,
240
+ ['myComponent ' , ['prop ' => 'Hi ' ]],
241
+ '/^Undefined variable:? \$?prop$/ '
242
+ ],
243
+ [
244
+ $ html2 ,
230
245
['input ' , ['type ' => 'number ' ]],
231
246
'/^.*$/ '
232
247
],
0 commit comments