From d621ce1357687ca4dcf1f744a1da939098f0e39e Mon Sep 17 00:00:00 2001 From: nickurt Date: Wed, 3 Jan 2018 14:25:43 +0100 Subject: [PATCH 1/2] remove php_eol statements by html-tags #456 --- src/HtmlBuilder.php | 10 +++++----- tests/HtmlBuilderTest.php | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/HtmlBuilder.php b/src/HtmlBuilder.php index d2ba3cd..8cecc65 100755 --- a/src/HtmlBuilder.php +++ b/src/HtmlBuilder.php @@ -78,7 +78,7 @@ class HtmlBuilder { $attributes['src'] = $this->url->asset($url, $secure); - return $this->toHtmlString('attributes($attributes) . '>' . PHP_EOL); + return $this->toHtmlString('attributes($attributes) . '>'); } /** @@ -98,7 +98,7 @@ class HtmlBuilder $attributes['href'] = $this->url->asset($url, $secure); - return $this->toHtmlString('attributes($attributes) . '>' . PHP_EOL); + return $this->toHtmlString('attributes($attributes) . '>'); } /** @@ -136,7 +136,7 @@ class HtmlBuilder $attributes['href'] = $this->url->asset($url, $secure); - return $this->toHtmlString('attributes($attributes) . '>' . PHP_EOL); + return $this->toHtmlString('attributes($attributes) . '>'); } /** @@ -511,7 +511,7 @@ class HtmlBuilder $attributes = array_merge($defaults, $attributes); - return $this->toHtmlString('attributes($attributes) . '>' . PHP_EOL); + return $this->toHtmlString('attributes($attributes) . '>'); } /** @@ -526,7 +526,7 @@ class HtmlBuilder public function tag($tag, $content, array $attributes = []) { $content = is_array($content) ? implode(PHP_EOL, $content) : $content; - return $this->toHtmlString('<' . $tag . $this->attributes($attributes) . '>' . PHP_EOL . $this->toHtmlString($content) . PHP_EOL . '' . PHP_EOL); + return $this->toHtmlString('<' . $tag . $this->attributes($attributes) . '>' . $this->toHtmlString($content) . ''); } /** diff --git a/tests/HtmlBuilderTest.php b/tests/HtmlBuilderTest.php index b5d7d99..a5bcb8b 100644 --- a/tests/HtmlBuilderTest.php +++ b/tests/HtmlBuilderTest.php @@ -65,7 +65,7 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase { $result = $this->htmlBuilder->meta('description', 'Lorem ipsum dolor sit amet.'); - $this->assertEquals('' . PHP_EOL, $result); + $this->assertEquals('', $result); } public function testTag() @@ -83,17 +83,17 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase $result4 = $this->htmlBuilder->tag('div', $content, ['class' => 'row']); - $this->assertEquals('

' . PHP_EOL . 'Lorem ipsum dolor sit amet.' . PHP_EOL . '

' . PHP_EOL, $result1); - $this->assertEquals('

' . PHP_EOL . 'Lorem ipsum dolor sit amet.' . PHP_EOL . '

' . PHP_EOL, $result2); - $this->assertEquals('
' . PHP_EOL . '

Lorem ipsum dolor sit amet.

' . PHP_EOL . '
' . PHP_EOL, $result3); - $this->assertEquals('
' . PHP_EOL . '' . PHP_EOL . '' . PHP_EOL . '
' . PHP_EOL, $result4); + $this->assertEquals('

Lorem ipsum dolor sit amet.

', $result1); + $this->assertEquals('

Lorem ipsum dolor sit amet.

', $result2); + $this->assertEquals('

Lorem ipsum dolor sit amet.

', $result3); + $this->assertEquals('
', $result4); } public function testMetaOpenGraph() { $result = $this->htmlBuilder->meta(null, 'website', ['property' => 'og:type']); - $this->assertEquals('' . PHP_EOL, $result); + $this->assertEquals('', $result); } public function testFavicon() @@ -102,7 +102,7 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase $target = $this->urlGenerator->to('bar.ico'); $result = $this->htmlBuilder->favicon('http://foo.com/bar.ico'); - $this->assertEquals('' . PHP_EOL, $result); + $this->assertEquals('', $result); } public function testComponentRegistration() From 29253c13a311b11e437cf0d9e1247375a74a97e4 Mon Sep 17 00:00:00 2001 From: nickurt Date: Wed, 3 Jan 2018 14:50:42 +0100 Subject: [PATCH 2/2] fixed tests .. --- src/HtmlBuilder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/HtmlBuilder.php b/src/HtmlBuilder.php index 8cecc65..210c7e7 100755 --- a/src/HtmlBuilder.php +++ b/src/HtmlBuilder.php @@ -525,7 +525,7 @@ class HtmlBuilder */ public function tag($tag, $content, array $attributes = []) { - $content = is_array($content) ? implode(PHP_EOL, $content) : $content; + $content = is_array($content) ? implode('', $content) : $content; return $this->toHtmlString('<' . $tag . $this->attributes($attributes) . '>' . $this->toHtmlString($content) . ''); }