mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Make OPML parser protected
This commit is contained in:
parent
61fe673e20
commit
30cede9ea4
3 changed files with 4 additions and 3 deletions
|
@ -141,7 +141,7 @@ abstract class AbstractImportExport {
|
|||
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;
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ use JKingWeb\Arsse\Arsse;
|
|||
use JKingWeb\Arsse\User\Exception as UserException;
|
||||
|
||||
class OPML extends AbstractImportExport {
|
||||
public function parse(string $opml, bool $flat): array {
|
||||
protected function parse(string $opml, bool $flat): array {
|
||||
$d = new \DOMDocument;
|
||||
if (!@$d->loadXML($opml)) {
|
||||
// not a valid XML document
|
||||
|
|
|
@ -109,7 +109,8 @@ OPML_EXPORT_SERIALIZATION;
|
|||
/** @dataProvider provideParserData */
|
||||
public function testParseOpmlForImport(string $file, bool $flat, $exp) {
|
||||
$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) {
|
||||
$this->assertException($exp);
|
||||
$parser->parse($data, $flat);
|
||||
|
|
Loading…
Reference in a new issue