Skip to content

Commit

Permalink
Test encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolus committed Apr 15, 2019
1 parent 26c59f4 commit 16f9331
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/Encoding/EncodingTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace PicoFeed\Filter;

use PHPUnit\Framework\TestCase;
use PicoFeed\Config\Config;
use PicoFeed\Parser\Rss20;

class EncodingTest extends TestCase
{
public function testTranslitIsoToUtf8()
{
$parser = new Rss20(file_get_contents(__DIR__.'/../../tests/fixtures/rss_20_iso8859-15.xml'));
$feed = $parser->execute();

$content = $feed->getItems()[0]->getContent();

$this->assertEquals($content, '<p>éàùç€@ïî</p>');
}
}
14 changes: 14 additions & 0 deletions tests/fixtures/rss_20_iso8859-15.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="ISO-8859-15" ?>
<rss version="2.0">

<channel>
<title>Test feed for encoding conversion</title>
<link>https://www.google.com</link>
<description>The first item contains accentuated characters</description>
<item>
<title>RSS Tutorial</title>
<link>https://www.google.com</link>
<description>éàùç¤@ïî</description>
</item>
</channel>
</rss>

0 comments on commit 16f9331

Please sign in to comment.