1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Make OPML parser protected

This commit is contained in:
J. King 2019-07-05 14:58:05 -04:00
parent 61fe673e20
commit 30cede9ea4
3 changed files with 4 additions and 3 deletions

View file

@ -141,7 +141,7 @@ abstract class AbstractImportExport {
return true; return true;
} }
abstract public function parse(string $data, bool $flat): array; abstract protected function parse(string $data, bool $flat): array;
abstract public function export(string $user, bool $flat = false): string; abstract public function export(string $user, bool $flat = false): string;

View file

@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse;
use JKingWeb\Arsse\User\Exception as UserException; use JKingWeb\Arsse\User\Exception as UserException;
class OPML extends AbstractImportExport { class OPML extends AbstractImportExport {
public function parse(string $opml, bool $flat): array { protected function parse(string $opml, bool $flat): array {
$d = new \DOMDocument; $d = new \DOMDocument;
if (!@$d->loadXML($opml)) { if (!@$d->loadXML($opml)) {
// not a valid XML document // not a valid XML document

View file

@ -109,7 +109,8 @@ OPML_EXPORT_SERIALIZATION;
/** @dataProvider provideParserData */ /** @dataProvider provideParserData */
public function testParseOpmlForImport(string $file, bool $flat, $exp) { public function testParseOpmlForImport(string $file, bool $flat, $exp) {
$data = file_get_contents(\JKingWeb\Arsse\DOCROOT."Import/OPML/$file"); $data = file_get_contents(\JKingWeb\Arsse\DOCROOT."Import/OPML/$file");
$parser = new OPML; // set up a partial mock to make the ImportExport::parse() method visible
$parser = \Phake::makeVisible(\Phake::partialMock(OPML::class));
if ($exp instanceof \JKingWeb\Arsse\AbstractException) { if ($exp instanceof \JKingWeb\Arsse\AbstractException) {
$this->assertException($exp); $this->assertException($exp);
$parser->parse($data, $flat); $parser->parse($data, $flat);