diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-04-03 22:08:32 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-04-15 00:41:42 +0200 |
commit | b6459e617289f729da1372b40f5a35940943f36d (patch) | |
tree | 8a27cac30b34a27fd91d426b82d429bef1ed1934 /tests | |
parent | b4f65840d166db6c0244a773e8fe2693cb3f5d2e (diff) | |
download | volse-hubzilla-b6459e617289f729da1372b40f5a35940943f36d.tar.gz volse-hubzilla-b6459e617289f729da1372b40f5a35940943f36d.tar.bz2 volse-hubzilla-b6459e617289f729da1372b40f5a35940943f36d.zip |
:arrow_up: Update SimplePie library.
As a follow up to issue #699 update SimplePie from 1.2.1-dev (around
6years old) to current git master (1.4.4-dev). We use the master branch
until the next release because it contains our patch for enclosure
titles already. The other patches in the library from us can be done by
configuring the SimplePie object in our code instead.
Used composer to manage this library and use class autoloading.
Add some unit tests for include/feedutils.php, but the interesting parts
are unfortunately not testable with the current code.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/unit/includes/FeedutilsText.php | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/unit/includes/FeedutilsText.php b/tests/unit/includes/FeedutilsText.php new file mode 100644 index 000000000..e3eaa91a7 --- /dev/null +++ b/tests/unit/includes/FeedutilsText.php @@ -0,0 +1,52 @@ +<?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' + ]]]; + $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' + }*/ + + public function test_atom_author() { + $this->assertEquals('', atom_author('', 'name', 'uri', 72, 72, 'png', 'photourl')); + + $a = '<tag> + <name>name</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" /> +</tag>'; + + $this->assertXmlStringEqualsXmlString($a, atom_author('tag', 'name', 'uri', 72, 72, 'png', 'http://photourl')); + } +} |