From dc15cf8463afb980049bc9aba5b0a7856435a746 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Tue, 16 Aug 2016 09:24:57 +0200 Subject: [PATCH] Add test for boolean attributes --- tests/HtmlBuilderTest.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/tests/HtmlBuilderTest.php b/tests/HtmlBuilderTest.php index 44baeb8..1406ad7 100644 --- a/tests/HtmlBuilderTest.php +++ b/tests/HtmlBuilderTest.php @@ -58,7 +58,7 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase $this->htmlBuilder->image('http://example.com/image1'), $this->htmlBuilder->image('http://example.com/image2'), ]; - + $result4 = $this->htmlBuilder->tag('div', $content, ['class' => 'row']); $this->assertEquals('

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

' . PHP_EOL, $result1); @@ -115,4 +115,15 @@ class HtmlBuilderTest extends PHPUnit_Framework_TestCase $this->assertEquals('<span>First Name Last</span>', $result1); $this->assertEquals('First Name Last', $result2); } + + public function testBooleanAttributes() + { + $result1 = $this->htmlBuilder->attributes(['my-property' => true]); + + $result2 = $this->htmlBuilder->attributes(['my-property' => false]); + + $this->assertEquals('my-property', trim($result1)); + + $this->assertEquals('', trim($result2)); + } }