public function JmesPathParserTest::testEucJpEncoded in Feeds extensible parsers 8
Tests a EUC-JP (Japanese) encoded file.
This implicitly tests Base's encoding conversion.
File
- tests/
src/ Unit/ Feeds/ Parser/ JmesPathParserTest.php, line 79
Class
- JmesPathParserTest
- @coversDefaultClass \Drupal\feeds_ex\Feeds\Parser\JmesPathParser @group feeds_ex
Namespace
Drupal\Tests\feeds_ex\Unit\Feeds\ParserCode
public function testEucJpEncoded() {
$fetcher_result = new RawFetcherResult(file_get_contents($this->moduleDir . '/tests/resources/test_jp.json'), $this->fileSystem);
$config = [
'context' => [
'value' => 'items',
],
'sources' => [
'title' => [
'name' => 'Title',
'value' => 'title',
],
'description' => [
'name' => 'Title',
'value' => 'description',
],
],
'source_encoding' => [
'EUC-JP',
],
];
$this->parser
->setConfiguration($config);
$result = $this->parser
->parse($this->feed, $fetcher_result, $this->state);
$this
->assertCount(3, $result);
foreach ($result as $delta => $item) {
$this
->assertSame('私はタイトルです' . $delta, $item
->get('title'));
$this
->assertSame('私が説明してい' . $delta, $item
->get('description'));
}
}