Skip to content

Commit c303ba1

Browse files
committed
Unit tests fixes.
1 parent 1ca45b5 commit c303ba1

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tests/Test.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function testProccessHTML()
2222

2323
$compiler = new \IvoPetkov\HTMLServerComponentsCompiler();
2424
$result = $compiler->process('<component src="file:' . $fullFilename . '"/>');
25-
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><meta custom="value"></head><body>text1</body></html>';
25+
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><meta custom="value"></head>' . "\n" . '<body>text1</body></html>';
2626
$this->assertTrue($result === $expectedResult);
2727

2828
$compiler = new \IvoPetkov\HTMLServerComponentsCompiler();
@@ -49,7 +49,7 @@ public function testAlias()
4949
$compiler = new \IvoPetkov\HTMLServerComponentsCompiler();
5050
$compiler->addAlias('component1', 'file:' . $fullFilename);
5151

52-
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><body>text1</body></html>';
52+
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html>' . "\n" . '<body>text1</body></html>';
5353

5454
$result = $compiler->process('<component src="file:' . $fullFilename . '" />');
5555
$this->assertTrue($result === $expectedResult);
@@ -71,13 +71,13 @@ public function testTags()
7171
$compiler->addTag('my-tag', 'component1');
7272

7373
$result = $compiler->process('<mytag value="text1"/>');
74-
$this->assertTrue($result === '<!DOCTYPE html>' . "\n" . '<html><body>text1</body></html>');
74+
$this->assertTrue($result === '<!DOCTYPE html>' . "\n" . '<html>' . "\n" . '<body>text1</body></html>');
7575

7676
$result = $compiler->process('<my-tag value="text2"/>');
77-
$this->assertTrue($result === '<!DOCTYPE html>' . "\n" . '<html><body>text2</body></html>');
77+
$this->assertTrue($result === '<!DOCTYPE html>' . "\n" . '<html>' . "\n" . '<body>text2</body></html>');
7878

7979
$result = $compiler->process('<mytag value="text1"/><my-tag value="text2"/><component src="component1" value="text3"/><component src="file:' . $fullFilename . '" value="text4"/>');
80-
$this->assertTrue($result === '<!DOCTYPE html>' . "\n" . '<html><body>text1text2text3text4</body></html>');
80+
$this->assertTrue($result === '<!DOCTYPE html>' . "\n" . '<html>' . "\n" . '<body>text1text2text3text4</body></html>');
8181
}
8282

8383
/**
@@ -125,11 +125,11 @@ public function testProccessRecursion()
125125

126126
$compiler = new \IvoPetkov\HTMLServerComponentsCompiler();
127127
$result = $compiler->process('<component src="file:' . $fullFilename3 . '"/>');
128-
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><meta custom="value3"><meta custom="value2"><meta custom="value1"></head><body>text1text2text3</body></html>';
128+
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><meta custom="value3"><meta custom="value2"><meta custom="value1"></head>' . "\n" . '<body>text1text2text3</body></html>';
129129
$this->assertTrue($result === $expectedResult);
130130

131131
$result = $compiler->process('<component src="file:' . $fullFilename3 . '"/>', ['recursive' => false]);
132-
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><meta custom="value3"></head><body><component src="file:' . urlencode($fullFilename2) . '"></component>text3</body></html>';
132+
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><meta custom="value3"></head>' . "\n" . '<body><component src="file:' . urlencode($fullFilename2) . '"></component>text3</body></html>';
133133
$this->assertTrue($result === $expectedResult);
134134
}
135135

@@ -141,7 +141,7 @@ public function testProccessData()
141141

142142
$compiler = new \IvoPetkov\HTMLServerComponentsCompiler();
143143
$result = $compiler->process('<component src="data:base64,' . base64_encode('<html><body>text1</body></html>') . '" />');
144-
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><body>text1</body></html>';
144+
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html>' . "\n" . '<body>text1</body></html>';
145145
$this->assertTrue($result === $expectedResult);
146146
}
147147

@@ -156,7 +156,7 @@ public function testComponentInComponentInnerHTML()
156156

157157
$compiler = new \IvoPetkov\HTMLServerComponentsCompiler();
158158
$result = $compiler->process('<component src="file:' . $fullFilename2 . '"><component src="file:' . $fullFilename1 . '"/></component>');
159-
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><title>hi</title></head><body>text1</body></html>';
159+
$expectedResult = '<!DOCTYPE html>' . "\n" . '<html><head><title>hi</title></head>' . "\n" . '<body>text1</body></html>';
160160
$this->assertTrue($result === $expectedResult);
161161
}
162162

0 commit comments

Comments
 (0)