|
@ -17,7 +17,7 @@ use JKingWeb\Arsse\ImportExport\OPML; |
|
|
|
|
|
|
|
|
/** @covers \JKingWeb\Arsse\CLI */ |
|
|
/** @covers \JKingWeb\Arsse\CLI */ |
|
|
class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
public function setUp() { |
|
|
public function setUp(): void { |
|
|
self::clearData(false); |
|
|
self::clearData(false); |
|
|
$this->cli = \Phake::partialMock(CLI::class); |
|
|
$this->cli = \Phake::partialMock(CLI::class); |
|
|
\Phake::when($this->cli)->logError->thenReturn(null); |
|
|
\Phake::when($this->cli)->logError->thenReturn(null); |
|
@ -57,7 +57,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertLoaded(false); |
|
|
$this->assertLoaded(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideHelpText() { |
|
|
public function provideHelpText(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php --help", "arsse.php"], |
|
|
["arsse.php --help", "arsse.php"], |
|
|
["arsse --help", "arsse"], |
|
|
["arsse --help", "arsse"], |
|
@ -98,7 +98,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
\Phake::verify(Arsse::$db)->feedUpdate; |
|
|
\Phake::verify(Arsse::$db)->feedUpdate; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideFeedUpdates() { |
|
|
public function provideFeedUpdates(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php feed refresh 1", 0, ""], |
|
|
["arsse.php feed refresh 1", 0, ""], |
|
|
["arsse.php feed refresh 2", 10502, ""], |
|
|
["arsse.php feed refresh 2", 10502, ""], |
|
@ -117,7 +117,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
\Phake::verify($conf)->exportFile($file, true); |
|
|
\Phake::verify($conf)->exportFile($file, true); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideDefaultConfigurationSaves() { |
|
|
public function provideDefaultConfigurationSaves(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php conf save-defaults", 0, "php://output"], |
|
|
["arsse.php conf save-defaults", 0, "php://output"], |
|
|
["arsse.php conf save-defaults -", 0, "php://output"], |
|
|
["arsse.php conf save-defaults -", 0, "php://output"], |
|
@ -134,7 +134,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideUserList() { |
|
|
public function provideUserList(): iterable { |
|
|
$list = ["john.doe@example.com", "jane.doe@example.com"]; |
|
|
$list = ["john.doe@example.com", "jane.doe@example.com"]; |
|
|
$str = implode(PHP_EOL, $list); |
|
|
$str = implode(PHP_EOL, $list); |
|
|
return [ |
|
|
return [ |
|
@ -160,7 +160,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideUserAdditions() { |
|
|
public function provideUserAdditions(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php user add john.doe@example.com", 10403, ""], |
|
|
["arsse.php user add john.doe@example.com", 10403, ""], |
|
|
["arsse.php user add jane.doe@example.com", 0, "random password"], |
|
|
["arsse.php user add jane.doe@example.com", 0, "random password"], |
|
@ -186,7 +186,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideUserAuthentication() { |
|
|
public function provideUserAuthentication(): iterable { |
|
|
$l = new \JKingWeb\Arsse\Lang; |
|
|
$l = new \JKingWeb\Arsse\Lang; |
|
|
$success = $l("CLI.Auth.Success"); |
|
|
$success = $l("CLI.Auth.Success"); |
|
|
$failure = $l("CLI.Auth.Failure"); |
|
|
$failure = $l("CLI.Auth.Failure"); |
|
@ -215,7 +215,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideUserRemovals() { |
|
|
public function provideUserRemovals(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php user remove john.doe@example.com", 0, ""], |
|
|
["arsse.php user remove john.doe@example.com", 0, ""], |
|
|
["arsse.php user remove jane.doe@example.com", 10402, ""], |
|
|
["arsse.php user remove jane.doe@example.com", 10402, ""], |
|
@ -241,7 +241,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideUserPasswordChanges() { |
|
|
public function provideUserPasswordChanges(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php user set-pass john.doe@example.com", 0, "random password"], |
|
|
["arsse.php user set-pass john.doe@example.com", 0, "random password"], |
|
|
["arsse.php user set-pass john.doe@example.com superman", 0, ""], |
|
|
["arsse.php user set-pass john.doe@example.com superman", 0, ""], |
|
@ -271,7 +271,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideUserPasswordClearings() { |
|
|
public function provideUserPasswordClearings(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php user unset-pass john.doe@example.com", 0, ""], |
|
|
["arsse.php user unset-pass john.doe@example.com", 0, ""], |
|
|
["arsse.php user unset-pass jane.doe@example.com", 10402, ""], |
|
|
["arsse.php user unset-pass jane.doe@example.com", 10402, ""], |
|
@ -292,7 +292,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
\Phake::verify($opml)->exportFile($file, $user, $flat); |
|
|
\Phake::verify($opml)->exportFile($file, $user, $flat); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideOpmlExports() { |
|
|
public function provideOpmlExports(): iterable { |
|
|
return [ |
|
|
return [ |
|
|
["arsse.php export john.doe@example.com", 0, "php://output", "john.doe@example.com", false], |
|
|
["arsse.php export john.doe@example.com", 0, "php://output", "john.doe@example.com", false], |
|
|
["arsse.php export john.doe@example.com -", 0, "php://output", "john.doe@example.com", false], |
|
|
["arsse.php export john.doe@example.com -", 0, "php://output", "john.doe@example.com", false], |
|
@ -333,7 +333,7 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest { |
|
|
\Phake::verify($opml)->importFile($file, $user, $flat, $replace); |
|
|
\Phake::verify($opml)->importFile($file, $user, $flat, $replace); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public function provideOpmlImports() { |
|
|
public function provideOpmlImports(): iterable { |
|
|
return [ |
|
|
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 -", 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], |
|
|