|
|
@ -311,6 +311,63 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
|
["arsse.php export jane.doe@example.com - --flat", 0, "php://output", "jane.doe@example.com", true], |
|
|
|
["arsse.php export --flat jane.doe@example.com good.opml", 0, "good.opml", "jane.doe@example.com", true], |
|
|
|
["arsse.php export jane.doe@example.com bad.opml --flat", 10604, "bad.opml", "jane.doe@example.com", true], |
|
|
|
["arsse.php export john.doe@example.com -f", 0, "php://output", "john.doe@example.com", true], |
|
|
|
["arsse.php export john.doe@example.com - -f", 0, "php://output", "john.doe@example.com", true], |
|
|
|
["arsse.php export -f john.doe@example.com good.opml", 0, "good.opml", "john.doe@example.com", true], |
|
|
|
["arsse.php export john.doe@example.com bad.opml -f", 10604, "bad.opml", "john.doe@example.com", true], |
|
|
|
["arsse.php export jane.doe@example.com -f", 0, "php://output", "jane.doe@example.com", true], |
|
|
|
["arsse.php export jane.doe@example.com - -f", 0, "php://output", "jane.doe@example.com", true], |
|
|
|
["arsse.php export -f jane.doe@example.com good.opml", 0, "good.opml", "jane.doe@example.com", true], |
|
|
|
["arsse.php export jane.doe@example.com bad.opml -f", 10604, "bad.opml", "jane.doe@example.com", true], |
|
|
|
]; |
|
|
|
} |
|
|
|
|
|
|
|
/** @dataProvider provideOpmlImports */ |
|
|
|
public function testImportFromOpml(string $cmd, int $exitStatus, string $file, string $user, bool $flat, bool $replace) { |
|
|
|
$opml = Phake::mock(OPML::class); |
|
|
|
Phake::when($opml)->importFile("php://input", $user, $flat, $replace)->thenReturn(true); |
|
|
|
Phake::when($opml)->importFile("good.opml", $user, $flat, $replace)->thenReturn(true); |
|
|
|
Phake::when($opml)->importFile("bad.opml", $user, $flat, $replace)->thenThrow(new \JKingWeb\Arsse\ImportExport\Exception("fileUnreadable")); |
|
|
|
Phake::when($this->cli)->getInstance(OPML::class)->thenReturn($opml); |
|
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus); |
|
|
|
$this->assertLoaded(true); |
|
|
|
Phake::verify($opml)->importFile($file, $user, $flat, $replace); |
|
|
|
} |
|
|
|
|
|
|
|
public function provideOpmlImports() { |
|
|
|
return [ |
|
|
|
["arsse.php import john.doe@example.com", 0, "php://input", "john.doe@example.com", false, false], |
|
|
|
["arsse.php import john.doe@example.com -", 0, "php://input", "john.doe@example.com", false, false], |
|
|
|
["arsse.php import john.doe@example.com good.opml", 0, "good.opml", "john.doe@example.com", false, false], |
|
|
|
["arsse.php import john.doe@example.com bad.opml", 10603, "bad.opml", "john.doe@example.com", false, false], |
|
|
|
["arsse.php import john.doe@example.com --flat", 0, "php://input", "john.doe@example.com", true, false], |
|
|
|
["arsse.php import john.doe@example.com - --flat", 0, "php://input", "john.doe@example.com", true, false], |
|
|
|
["arsse.php import --flat john.doe@example.com good.opml", 0, "good.opml", "john.doe@example.com", true, false], |
|
|
|
["arsse.php import john.doe@example.com bad.opml --flat", 10603, "bad.opml", "john.doe@example.com", true, false], |
|
|
|
["arsse.php import jane.doe@example.com", 0, "php://input", "jane.doe@example.com", false, false], |
|
|
|
["arsse.php import jane.doe@example.com -", 0, "php://input", "jane.doe@example.com", false, false], |
|
|
|
["arsse.php import jane.doe@example.com good.opml", 0, "good.opml", "jane.doe@example.com", false, false], |
|
|
|
["arsse.php import jane.doe@example.com bad.opml", 10603, "bad.opml", "jane.doe@example.com", false, false], |
|
|
|
["arsse.php import jane.doe@example.com --flat", 0, "php://input", "jane.doe@example.com", true, false], |
|
|
|
["arsse.php import jane.doe@example.com - --flat", 0, "php://input", "jane.doe@example.com", true, false], |
|
|
|
["arsse.php import --flat jane.doe@example.com good.opml", 0, "good.opml", "jane.doe@example.com", true, false], |
|
|
|
["arsse.php import jane.doe@example.com bad.opml --flat", 10603, "bad.opml", "jane.doe@example.com", true, false], |
|
|
|
["arsse.php import john.doe@example.com --replace", 0, "php://input", "john.doe@example.com", false, true], |
|
|
|
["arsse.php import john.doe@example.com - -r", 0, "php://input", "john.doe@example.com", false, true], |
|
|
|
["arsse.php import --replace john.doe@example.com good.opml", 0, "good.opml", "john.doe@example.com", false, true], |
|
|
|
["arsse.php import -r john.doe@example.com bad.opml", 10603, "bad.opml", "john.doe@example.com", false, true], |
|
|
|
["arsse.php import --replace john.doe@example.com --flat", 0, "php://input", "john.doe@example.com", true, true], |
|
|
|
["arsse.php import -r john.doe@example.com - --flat", 0, "php://input", "john.doe@example.com", true, true], |
|
|
|
["arsse.php import --flat john.doe@example.com good.opml -r", 0, "good.opml", "john.doe@example.com", true, true], |
|
|
|
["arsse.php import --replace john.doe@example.com bad.opml --flat", 10603, "bad.opml", "john.doe@example.com", true, true], |
|
|
|
["arsse.php import jane.doe@example.com -r ", 0, "php://input", "jane.doe@example.com", false, true], |
|
|
|
["arsse.php import jane.doe@example.com - --replace", 0, "php://input", "jane.doe@example.com", false, true], |
|
|
|
["arsse.php import -r jane.doe@example.com good.opml", 0, "good.opml", "jane.doe@example.com", false, true], |
|
|
|
["arsse.php import --replace jane.doe@example.com bad.opml", 10603, "bad.opml", "jane.doe@example.com", false, true], |
|
|
|
["arsse.php import jane.doe@example.com --flat -r", 0, "php://input", "jane.doe@example.com", true, true], |
|
|
|
["arsse.php import jane.doe@example.com - --flat --replace", 0, "php://input", "jane.doe@example.com", true, true], |
|
|
|
["arsse.php import --flat jane.doe@example.com good.opml -r", 0, "good.opml", "jane.doe@example.com", true, true], |
|
|
|
["arsse.php import jane.doe@example.com bad.opml --replace --flat", 10603, "bad.opml", "jane.doe@example.com", true, true], |
|
|
|
]; |
|
|
|
} |
|
|
|
} |
|
|
|