summaryrefslogtreecommitdiffstats
path: root/vendor/fguillot/picofeed/tests/Filter
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-01-27 09:29:09 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-01-27 09:29:09 +0100
commit73f65c8fbadbdd2098448e77b6d3f0464ad8613e (patch)
treef22ba63a222fb4f7d05427b661f3c008170047fd /vendor/fguillot/picofeed/tests/Filter
parentbe37aed9f5d923fe16e264c6ffc97db08503b791 (diff)
update picofeed
Diffstat (limited to 'vendor/fguillot/picofeed/tests/Filter')
m---------vendor/fguillot/picofeed0
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php175
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/FilterTest.php123
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php168
-rw-r--r--vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php33
5 files changed, 0 insertions, 499 deletions
diff --git a/vendor/fguillot/picofeed b/vendor/fguillot/picofeed
new file mode 160000
+Subproject 0a1d0d3950f7f047dc8fb1d80aa6296e15f306d
diff --git a/vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php
deleted file mode 100644
index b0de530e7..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/AttributeFilterTest.php
+++ /dev/null
@@ -1,175 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-use PicoFeed\Client\Url;
-
-
-class AttributeFilterTest extends PHPUnit_Framework_TestCase
-{
- public function testFilterEmptyAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterEmptyAttribute('abbr', 'title', 'test'));
- $this->assertFalse($filter->filterEmptyAttribute('abbr', 'title', ''));
- $this->assertEquals(array('title' => 'test'), $filter->filter('abbr', array('title' => 'test')));
- $this->assertEquals(array(), $filter->filter('abbr', array('title' => '')));
- }
-
- public function testFilterAllowedAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterAllowedAttribute('abbr', 'title', 'test'));
- $this->assertFalse($filter->filterAllowedAttribute('script', 'type', 'text/javascript'));
-
- $this->assertEquals(array(), $filter->filter('script', array('type' => 'text/javascript')));
- $this->assertEquals(array(), $filter->filter('a', array('onclick' => 'javascript')));
- $this->assertEquals(array('href' => 'http://google.com/'), $filter->filter('a', array('href' => 'http://google.com')));
- }
-
- public function testFilterIntegerAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterIntegerAttribute('abbr', 'title', 'test'));
- $this->assertTrue($filter->filterIntegerAttribute('iframe', 'width', '0'));
- $this->assertTrue($filter->filterIntegerAttribute('iframe', 'width', '450'));
- $this->assertFalse($filter->filterIntegerAttribute('iframe', 'width', 'test'));
-
- $this->assertEquals(array('width' => '10', 'src' => 'http://www.youtube.com/test'), $filter->filter('iframe', array('width' => '10', 'src' => 'http://www.youtube.com/test')));
- $this->assertEquals(array('src' => 'http://www.youtube.com/test'), $filter->filter('iframe', array('width' => 'test', 'src' => 'http://www.youtube.com/test')));
- }
-
- public function testRewriteProxyImageUrl()
- {
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteImageProxyUrl('a', 'href', $url));
- $this->assertEquals('/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'alt', $url));
- $this->assertEquals('/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'src', $url));
- $this->assertEquals('/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $filter->setImageProxyUrl('https://myproxy/?u=%s');
- $url = 'http://example.net/image.png';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'src', $url));
- $this->assertEquals('https://myproxy/?u='.urlencode('http://example.net/image.png'), $url);
-
- $filter = new Attribute(new Url('http://www.la-grange.net'));
-
- $filter->setImageProxyCallback(function ($image_url) {
- $key = hash_hmac('sha1', $image_url, 'secret');
- return 'https://mypublicproxy/'.$key.'/'.urlencode($image_url);
- });
-
- $url = 'http://example.net/image.png';
- $this->assertTrue($filter->rewriteImageProxyUrl('img', 'src', $url));
- $this->assertEquals('https://mypublicproxy/d9701029b054f6e178ef88fcd3c789365e52a26d/'.urlencode('http://example.net/image.png'), $url);
- }
-
- public function testRewriteAbsoluteUrl()
- {
- $filter = new Attribute(new Url('http://www.la-grange.net'));
- $url = '/2014/08/03/4668-noisettes';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('http://www.la-grange.net/2014/08/03/4668-noisettes', $url);
-
- $filter = new Attribute(new Url('http://google.com'));
-
- $url = 'test';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('http://google.com/test', $url);
-
- $url = 'http://127.0.0.1:8000/test';
- $this->assertTrue($filter->rewriteAbsoluteUrl('img', 'src', $url));
- $this->assertEquals('http://127.0.0.1:8000/test', $url);
-
- $url = '//example.com';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('http://example.com/', $url);
-
- $filter = new Attribute(new Url('https://google.com'));
- $url = '//example.com/?youpi';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('https://example.com/?youpi', $url);
-
- $filter = new Attribute(new Url('https://127.0.0.1:8000/here/'));
- $url = 'image.png?v=2';
- $this->assertTrue($filter->rewriteAbsoluteUrl('a', 'href', $url));
- $this->assertEquals('https://127.0.0.1:8000/here/image.png?v=2', $url);
-
- $filter = new Attribute(new Url('https://truc/'));
- $this->assertEquals(array('src' => 'https://www.youtube.com/test'), $filter->filter('iframe', array('width' => 'test', 'src' => '//www.youtube.com/test')));
-
- $filter = new Attribute(new Url('http://truc/'));
- $this->assertEquals(array('href' => 'http://google.fr/'), $filter->filter('a', array('href' => '//google.fr')));
- }
-
- public function testFilterIframeAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterIframeAttribute('iframe', 'src', 'http://www.youtube.com/test'));
- $this->assertTrue($filter->filterIframeAttribute('iframe', 'src', 'https://www.youtube.com/test'));
- $this->assertFalse($filter->filterIframeAttribute('iframe', 'src', '//www.youtube.com/test'));
- $this->assertFalse($filter->filterIframeAttribute('iframe', 'src', '//www.bidule.com/test'));
-
- $this->assertEquals(array('src' => 'http://www.youtube.com/test'), $filter->filter('iframe', array('src' => '//www.youtube.com/test')));
- }
-
- public function testFilterBlacklistAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterBlacklistResourceAttribute('a', 'href', 'http://google.fr/'));
- $this->assertFalse($filter->filterBlacklistResourceAttribute('a', 'href', 'http://res3.feedsportal.com/truc'));
-
- $this->assertEquals(array('href' => 'http://google.fr/'), $filter->filter('a', array('href' => 'http://google.fr/')));
- $this->assertEquals(array(), $filter->filter('a', array('href' => 'http://res3.feedsportal.com/')));
- }
-
- public function testFilterProtocolAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->filterProtocolUrlAttribute('a', 'href', 'http://google.fr/'));
- $this->assertFalse($filter->filterProtocolUrlAttribute('a', 'href', 'bla://google.fr/'));
- $this->assertFalse($filter->filterProtocolUrlAttribute('a', 'href', 'javascript:alert("test")'));
-
- $this->assertEquals(array('href' => 'http://google.fr/'), $filter->filter('a', array('href' => 'http://google.fr/')));
- $this->assertEquals(array(), $filter->filter('a', array('href' => 'bla://google.fr/')));
- }
-
- public function testRequiredAttribute()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertTrue($filter->hasRequiredAttributes('a', array('href' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('img', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('source', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('audio', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('iframe', array('src' => 'bla')));
- $this->assertTrue($filter->hasRequiredAttributes('p', array('class' => 'bla')));
- $this->assertFalse($filter->hasRequiredAttributes('a', array('title' => 'bla')));
- }
-
- public function testHtml()
- {
- $filter = new Attribute(new Url('http://google.com'));
-
- $this->assertEquals('title="A &amp; B"', $filter->toHtml(array('title' => 'A & B')));
- $this->assertEquals('title="&quot;a&quot;"', $filter->toHtml(array('title' => '"a"')));
- $this->assertEquals('title="ç" alt="b"', $filter->toHtml(array('title' => 'ç', 'alt' => 'b')));
- }
-}
diff --git a/vendor/fguillot/picofeed/tests/Filter/FilterTest.php b/vendor/fguillot/picofeed/tests/Filter/FilterTest.php
deleted file mode 100644
index 8bbb2b97c..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/FilterTest.php
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-use PicoFeed\Config\Config;
-
-
-class FilterTest extends PHPUnit_Framework_TestCase
-{
- public function testStripHeadTag()
- {
- $input = '<html><head><title>test</title></head><body><h1>boo</h1></body>';
- $expected = '<html><body><h1>boo</h1></body>';
- $this->assertEquals($expected, Filter::stripHeadTags($input));
-
- $input = file_get_contents('tests/fixtures/html_page.html');
- $expected = file_get_contents('tests/fixtures/html_head_stripped_page.html');
- $this->assertEquals($expected, Filter::stripHeadTags($input));
- }
-
- public function testStripXmlTag()
- {
- $data = file_get_contents('tests/fixtures/jeux-linux.fr.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/ezrss.it');
- $this->assertEquals('<!DOC', substr(Filter::stripXmlTag($data), 0, 5));
-
- $data = file_get_contents('tests/fixtures/fulltextrss.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/sametmax.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/grotte_barbu.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/ibash.ru.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/pcinpact.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/resorts.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/rue89.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/cercle.psy.xml');
- $this->assertEquals('<rss', substr(Filter::stripXmlTag($data), 0, 4));
-
- $data = file_get_contents('tests/fixtures/lagrange.xml');
- $this->assertEquals('<feed', substr(Filter::stripXmlTag($data), 0, 5));
-
- $data = file_get_contents('tests/fixtures/atom.xml');
- $this->assertEquals('<feed', substr(trim(Filter::stripXmlTag($data)), 0, 5));
-
- $data = file_get_contents('tests/fixtures/atomsample.xml');
- $this->assertEquals('<feed', substr(trim(Filter::stripXmlTag($data)), 0, 5));
-
- $data = file_get_contents('tests/fixtures/planete-jquery.xml');
- $this->assertEquals('<rdf:RDF', trim(substr(trim(Filter::stripXmlTag($data)), 0, 8)));
- }
-
- public function testOverrideFilters()
- {
- $data = '<iframe src="http://www.kickstarter.com/projects/lefnire/habitrpg-mobile/widget/video.html" height="480" width="640" frameborder="0"></iframe>';
-
- $f = Filter::html($data, 'http://blabla');
- $f->attribute->setIframeWhitelist(array('http://www.kickstarter.com'));
- $this->assertEquals($data, $f->execute());
-
- $data = '<iframe src="http://www.youtube.com/bla" height="480" width="640" frameborder="0"></iframe>';
-
- $f = Filter::html($data, 'http://blabla');
- $f->attribute->setIframeWhitelist(array('http://www.kickstarter.com'));
- $this->assertEmpty($f->execute());
-
- $config = new Config;
- $config->setFilterWhitelistedTags(array('p' => array('title')));
-
- $f = Filter::html('<p>Test<strong>boo</strong></p>', 'http://blabla');
- $f->setConfig($config);
- $this->assertEquals('<p>Testboo</p>', $f->execute());
- }
-
- public function testImageProxy()
- {
- $f = Filter::html('<p>Image <img src="/image.png" alt="My Image"/></p>', 'http://foo');
-
- $this->assertEquals(
- '<p>Image <img src="http://foo/image.png" alt="My Image"/></p>',
- $f->execute()
- );
-
- $config = new Config;
- $config->setFilterImageProxyUrl('http://myproxy/?url=%s');
-
- $f = Filter::html('<p>Image <img src="/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="http://myproxy/?url='.urlencode('http://foo/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
-
- $config = new Config;
- $config->setFilterImageProxyCallback(function ($image_url) {
- $key = hash_hmac('sha1', $image_url, 'secret');
- return 'https://mypublicproxy/'.$key.'/'.urlencode($image_url);
- });
-
- $f = Filter::html('<p>Image <img src="/image.png" alt="My Image"/></p>', 'http://foo');
- $f->setConfig($config);
-
- $this->assertEquals(
- '<p>Image <img src="https://mypublicproxy/4924964043f3119b3cf2b07b1922d491bcc20092/'.urlencode('http://foo/image.png').'" alt="My Image"/></p>',
- $f->execute()
- );
- }
-} \ No newline at end of file
diff --git a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php
deleted file mode 100644
index 271167481..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/HtmlFilterTest.php
+++ /dev/null
@@ -1,168 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-
-class HtmlFilterTest extends PHPUnit_Framework_TestCase
-{
- public function testExecute()
- {
- $html = '<!DOCTYPE html><html><head>
- <meta name="title" content="test">
- </head><body><p>boo<br/><strong>foo</strong>.</p></body></html>';
-
- $filter = new Html($html, 'http://www.google.ca/');
-
- $this->assertEquals('<p>boo<br/><strong>foo</strong>.</p>', $filter->execute());
- }
-
- public function testIframe()
- {
- $data = '<iframe src="http://www.kickstarter.com/projects/lefnire/habitrpg-mobile/widget/video.html" height="480" width="640" frameborder="0"></iframe>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEmpty($f->execute());
-
- $data = '<iframe src="http://www.youtube.com/bla" height="480" width="640" frameborder="0"></iframe>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEquals($data, $f->execute());
- }
-
- public function testEmptyTags()
- {
- $data = <<<EOD
-<div>
-<a href="file://path/to/a/file">
- <img src="http://example.com/image.png" />
-</a>
-</div>
-EOD;
- $f = new Html($data, 'http://blabla');
- $output = $f->execute();
-
- $this->assertEquals('<img src="http://example.com/image.png"/>', $output);
- }
-
- public function testBadAttributes()
- {
- $data = '<iframe src="http://www.youtube.com/bla" height="480px" width="100%" frameborder="0"></iframe>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEquals('<iframe src="http://www.youtube.com/bla" frameborder="0"></iframe>', $f->execute());
- }
-
- public function testRelativeScheme()
- {
- $f = new Html('<a href="//linuxfr.org">link</a>', 'http://blabla');
- $this->assertEquals('<a href="http://linuxfr.org/" rel="noreferrer" target="_blank">link</a>', $f->execute());
- }
-
- public function testAttributes()
- {
- $f = new Html('<img src="foo" title="\'quote" alt="\'quote" data-src="bar" data-truc="boo"/>', 'http://blabla');
- $this->assertEquals('<img src="http://blabla/foo" title="&#039;quote" alt="&#039;quote"/>', $f->execute());
-
- $f = new Html('<img src="foo&bar=\'quote"/>', 'http://blabla');
- $this->assertEquals('<img src="http://blabla/foo&amp;bar=&#039;quote"/>', $f->execute());
-
- $f = new Html("<time datetime='quote\"here'>bla</time>", 'http://blabla');
- $this->assertEquals('<time datetime="quote&quot;here">bla</time>', $f->execute());
- }
-
- public function testCode()
- {
- $data = '<pre><code>HEAD / HTTP/1.1
-Accept: text/html
-Accept-Encoding: gzip, deflate, compress
-Host: www.amazon.com
-User-Agent: HTTPie/0.6.0
-
-
-
-<strong>HTTP/1.1 405 MethodNotAllowed</strong>
-Content-Encoding: gzip
-Content-Type: text/html; charset=ISO-8859-1
-Date: Mon, 15 Jul 2013 02:05:59 GMT
-Server: Server
-Set-Cookie: skin=noskin; path=/; domain=.amazon.com; expires=Mon, 15-Jul-2013 02:05:59 GMT
-Vary: Accept-Encoding,User-Agent
-<strong>allow: POST, GET</strong>
-x-amz-id-1: 11WD3K15FC268R5GBJY5
-x-amz-id-2: DDjqfqz2ZJufzqRAcj1mh+9XvSogrPohKHwXlo8IlkzH67G6w4wnjn9HYgbs4uI0
-</code></pre>';
-
- $f = new Html($data, 'http://blabla');
- $this->assertEquals($data, $f->execute());
- }
-
- public function testRemoveNoBreakingSpace()
- {
- $f = new Html('<p>&nbsp;&nbsp;truc</p>', 'http://blabla');
- $this->assertEquals('<p> truc</p>', $f->execute());
- }
-
- public function testRemoveEmptyTags()
- {
- $f = new Html('<p>toto</p><p></p><br/>', 'http://blabla');
- $this->assertEquals('<p>toto</p><br/>', $f->execute());
-
- $f = new Html('<p> </p>', 'http://blabla');
- $this->assertEquals('', $f->execute());
-
- $f = new Html('<p>&nbsp;</p>', 'http://blabla');
- $this->assertEquals('', $f->execute());
- }
-
- public function testRemoveEmptyTable()
- {
- $f = new Html('<table><tr><td> </td></tr></table>', 'http://blabla');
- $this->assertEquals('', $f->execute());
-
- $f = new Html('<table><tr></tr></table>', 'http://blabla');
- $this->assertEquals('', $f->execute());
- }
-/*
- public function testFilter()
- {
- $input = <<<EOD
-<div xmlns="http://www.w3.org/1999/xhtml"><article>
-<figure>
- <img src="/2014/08/06/4694-pluie" alt="Flaque de pluie"/>
- <figcaption>La Saussaye, France, 6 août 2014</figcaption>
-</figure>
-
-<div lang="en" class="extrait">
- <blockquote cite="urn:isbn:978-0-8248-3742-6">
- <p>Spring had truly arrived. Countless streams suddenly materialized all over the roads, fields, grasslands, and thickets; flowing as if the melting snow's waters were spilling over. </p>
- </blockquote>
- <p class="source"><span class="auteur">Takiji Kobayashi</span>, <cite class="titre">Yasuko</cite>.</p>
-</div>
-
-<p>La pluie abonde. La forêt humide resplendit. L'eau monte, l'eau déborde. Il reste pourtant notre humanité. Toute entière, resplendissante.</p>
-
-</article>
-</div>
-EOD;
-
- $expected = <<<EOD
-<figure>
- <img src="http://www.la-grange.net/2014/08/06/4694-pluie" alt="Flaque de pluie"/>
- <figcaption>La Saussaye, France, 6 août 2014</figcaption>
-</figure>
-
-
- <blockquote>
- <p>Spring had truly arrived. Countless streams suddenly materialized all over the roads, fields, grasslands, and thickets; flowing as if the melting snow&#039;s waters were spilling over. </p>
- </blockquote>
- <p>Takiji Kobayashi, <cite>Yasuko</cite>.</p>
-
-
-<p>La pluie abonde. La forêt humide resplendit. L&#039;eau monte, l&#039;eau déborde. Il reste pourtant notre humanité. Toute entière, resplendissante.</p>
-EOD;
-
- $f = new Html($input, 'http://www.la-grange.net/');
- $this->assertEquals($expected, $f->execute());
- }*/
-}
diff --git a/vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php b/vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php
deleted file mode 100644
index 86911bbb4..000000000
--- a/vendor/fguillot/picofeed/tests/Filter/TagFilterTest.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-namespace PicoFeed\Filter;
-
-use PHPUnit_Framework_TestCase;
-
-
-class TagFilterTest extends PHPUnit_Framework_TestCase
-{
- public function testAllowedTag()
- {
- $tag = new Tag;
-
- $this->assertTrue($tag->isAllowed('p', array('class' => 'test')));
- $this->assertTrue($tag->isAllowed('img', array('class' => 'test')));
-
- $this->assertFalse($tag->isAllowed('script', array('class' => 'test')));
- $this->assertFalse($tag->isAllowed('img', array('width' => '1', 'height' => '1')));
- }
-
- public function testHtml()
- {
- $tag = new Tag;
-
- $this->assertEquals('<p>', $tag->openHtmlTag('p'));
- $this->assertEquals('<img src="test" alt="truc"/>', $tag->openHtmlTag('img', 'src="test" alt="truc"'));
- $this->assertEquals('<img/>', $tag->openHtmlTag('img'));
- $this->assertEquals('<br/>', $tag->openHtmlTag('br'));
-
- $this->assertEquals('</p>', $tag->closeHtmlTag('p'));
- $this->assertEquals('', $tag->closeHtmlTag('img'));
- $this->assertEquals('', $tag->closeHtmlTag('br'));
- }
-}