Skip to content

Commit 431a4e7

Browse files
committed
remove newlines and stuffs to fix render tests
1 parent 15ff651 commit 431a4e7

File tree

6 files changed

+23
-31
lines changed

6 files changed

+23
-31
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ charset = utf-8
88

99
[*.md]
1010
indent_size = 2
11+
12+
[tests/views/*.php]
13+
insert_final_newline = false

tests/FlightTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -396,15 +396,11 @@ public function testKeepThePreviousStateOfOneViewComponentByDefault(): void
396396
$html = <<<'html'
397397
<div>Hi</div>
398398
<div>Hi</div>
399-
400399
<input type="number" />
401-
402400
<input type="number" />
403-
404401
html;
405402

406-
// if windows replace \n with \r\n
407-
$html = str_replace(["\n", "\r\n"], PHP_EOL, $html);
403+
$html = str_replace(["\n", "\r\n"], '', $html);
408404

409405
$this->expectOutputString($html);
410406

tests/ViewTest.php

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -178,15 +178,12 @@ public function testKeepThePreviousStateOfOneViewComponentByDefault(): void
178178
$html = <<<'html'
179179
<div>Hi</div>
180180
<div>Hi</div>
181-
182181
<input type="number" />
183-
184182
<input type="number" />
185-
186183
html;
187184

188185
// if windows replace \n with \r\n
189-
$html = str_replace("\n", PHP_EOL, $html);
186+
$html = str_replace(["\n", "\r"], '', $html);
190187

191188
$this->expectOutputString($html);
192189

@@ -205,11 +202,9 @@ public function testKeepThePreviousStateOfDataSettedBySetMethod(): void
205202
$html = <<<'html'
206203
<div>qux</div>
207204
<div>bar</div>
208-
209205
html;
210206

211-
// if windows replace \n with \r\n
212-
$html = str_replace("\n", PHP_EOL, $html);
207+
$html = str_replace(["\n", "\r"], '', $html);
213208

214209
$this->expectOutputString($html);
215210

@@ -222,19 +217,15 @@ public static function renderDataProvider(): array
222217
$html1 = <<<'html'
223218
<div>Hi</div>
224219
<div></div>
225-
226220
html;
227221

228222
$html2 = <<<'html'
229-
230223
<input type="number" />
231-
232224
<input type="text" />
233-
234225
html;
235226

236-
$html1 = str_replace(["\n", "\r\n"], PHP_EOL, $html1);
237-
$html2 = str_replace(["\n", "\r\n"], PHP_EOL, $html2);
227+
$html1 = str_replace(["\n", "\r"], '', $html1);
228+
$html2 = str_replace(["\n", "\r"], '', $html2);
238229

239230
return [
240231
[

tests/commands/RouteCommandTest.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,18 @@ public function testGetPostRoute()
131131
$app->handle(['runway', 'routes', '--post']);
132132

133133
$this->assertStringContainsString('Routes', file_get_contents(static::$ou));
134-
$this->assertStringContainsString('+---------+---------+-------+----------+------------+
135-
| Pattern | Methods | Alias | Streamed | Middleware |
136-
+---------+---------+-------+----------+------------+
137-
| /post | POST | | No | Closure |
138-
+---------+---------+-------+----------+------------+', $this->removeColors(file_get_contents(static::$ou)));
134+
135+
$expected = <<<'output'
136+
+---------+---------+-------+----------+------------+
137+
| Pattern | Methods | Alias | Streamed | Middleware |
138+
+---------+---------+-------+----------+------------+
139+
| /post | POST | | No | Closure |
140+
+---------+---------+-------+----------+------------+
141+
output;
142+
143+
$this->assertStringContainsString(
144+
$expected,
145+
$this->removeColors(file_get_contents(static::$ou))
146+
);
139147
}
140148
}

tests/views/input.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1 @@
1-
<?php
2-
3-
$type ??= 'text';
4-
5-
?>
6-
7-
<input type="<?= $type ?>" />
1+
<input type="<?= $type ?? 'text' ?>" />

tests/views/myComponent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<div><?= $prop ?></div>
1+
<div><?= $prop ?></div>

0 commit comments

Comments
 (0)