public function RisDecodeTest::testPagesDecode in Bibliography & Citation 2.0.x
Same name and namespace in other branches
- 8 modules/bibcite_ris/tests/src/Kernel/RisDecodeTest.php \Drupal\Tests\bibcite_ris\Kernel\RisDecodeTest::testPagesDecode()
Tests a pages decode.
@coversDefaultClass
File
- modules/
bibcite_ris/ tests/ src/ Kernel/ RisDecodeTest.php, line 54
Class
- RisDecodeTest
- @coversDefaultClass \Drupal\bibcite_ris\Encoder\RISEncoder @group bibcite
Namespace
Drupal\Tests\bibcite_ris\KernelCode
public function testPagesDecode() {
$data = "TY - SER\nTI - test\nSP - 1\nEP - 3\nSP - 7\nEP - 9\nEP - 12\nSP - 19\nER - \n";
$pages = '1-3, 7-9, 12, 19+';
$example = [
0 => [
'TY' => 'SER',
'TI' => 'test',
'SP' => $pages,
'EP' => $pages,
],
];
$encoder = new RISEncoder();
$result = $encoder
->decode($data, 'ris');
$this
->assertEquals($example, $result);
}