From b6459e617289f729da1372b40f5a35940943f36d Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Mon, 3 Apr 2017 22:08:32 +0200 Subject: :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. --- tests/unit/includes/FeedutilsText.php | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 tests/unit/includes/FeedutilsText.php (limited to 'tests/unit') 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 @@ +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 = ' + name + uri + + +'; + + $this->assertXmlStringEqualsXmlString($a, atom_author('tag', 'name', 'uri', 72, 72, 'png', 'http://photourl')); + } +} -- cgit v1.2.3