diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-10-25 01:57:18 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-10-29 22:00:06 +0100 |
commit | 8e4c5db766ce23d05b8507991b04fece743147de (patch) | |
tree | 55c89f2c145f47245e7d32380c92256051d6a8f2 /tests/unit/includes/FeedutilsTest.php | |
parent | fe5f1e4d67d999ed3c6ef78dc4d49f5dd1a93056 (diff) | |
download | volse-hubzilla-8e4c5db766ce23d05b8507991b04fece743147de.tar.gz volse-hubzilla-8e4c5db766ce23d05b8507991b04fece743147de.tar.bz2 volse-hubzilla-8e4c5db766ce23d05b8507991b04fece743147de.zip |
:arrow_up: Update Text_LanguageDetect.
Update from v0.3.0 (2012) to v1.0.0 (2017) which should remove some
warnings and improve PHP7 support.
Using composer to handle this PEAR library now.
Fix a problem in FeedutilsTest.
Diffstat (limited to 'tests/unit/includes/FeedutilsTest.php')
-rw-r--r-- | tests/unit/includes/FeedutilsTest.php | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/unit/includes/FeedutilsTest.php b/tests/unit/includes/FeedutilsTest.php new file mode 100644 index 000000000..d27df4939 --- /dev/null +++ b/tests/unit/includes/FeedutilsTest.php @@ -0,0 +1,60 @@ +<?php + +namespace Zotlabs\Tests\Unit\includes; + +use Zotlabs\Tests\Unit\UnitTestCase; + +/** + * @brief Unit Test case for include/feedutils.php file. + */ +class FeedutilsTest extends UnitTestCase { + + public function test_normalise_id() { + $this->assertEquals('id', normalise_id('id')); + $this->assertEquals('id', normalise_id('X-ZOT:id')); + $this->assertEquals('id id2', normalise_id('X-ZOT:id X-ZOT:id2')); + $this->assertEmpty(normalise_id('')); + } + + public function test_encode_rel_links() { + // invalid params return empty array + $this->assertEquals([], encode_rel_links('string')); + $this->assertEquals([], encode_rel_links([])); + + $b = ['attribs' => ['' => [ + 'rel' => 'rel_value', + 'type' => 'type_value', + 'href' => 'href_value', + 'length' => 'length_value', + 'title' => 'title_value' + ]]]; + $blink1 = ['link1' => $b]; + $bresult[] = $b['attribs']['']; + $this->assertEquals($bresult, encode_rel_links($blink1)); + } + +/* public function test_encode_rel_links_fail() { + $a = [ 'key' => 'value']; + $this->assertFalse(encode_rel_links($a)); + //Illegal string offset 'attribs' + }*/ + + /** + * @uses ::xmlify + */ + public function test_atom_author() { + $this->assertEquals('', atom_author('', 'nick', 'name', 'uri', 72, 72, 'png', 'photourl')); + + $a = '<tag> + <id>uri</id> + <name>nick</name> + <uri>uri</uri> + <link rel="photo" type="png" media:width="72" media:height="72" href="http://photourl" /> + <link rel="avatar" type="png" media:width="72" media:height="72" href="http://photourl" /> + <poco:preferredUsername>nick</poco:preferredUsername> + <poco:displayName>name</poco:displayName> +</tag>'; + + $this->assertXmlStringEqualsXmlString($a, atom_author('tag', 'nick', 'name', 'uri', 72, 72, 'png', 'http://photourl')); + } +} |