namespace Friendica\Test\src\Console;
use Friendica\Console\ServerBlock;
+use Friendica\Core\Config\IConfig;
-/**
- * @runTestsInSeparateProcesses
- * @preserveGlobalState disabled
- */
class ServerBlockConsoleTest extends ConsoleTest
{
protected $defaultBlockList = [
{
parent::setUp();
- $this->mockApp($this->root);
+ $this->configMock = \Mockery::mock(IConfig::class);
}
/**
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$txt = $this->dumpExecute($console);
$output = <<<CONS
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
->andReturn(true)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'add');
$console->setArgument(1, 'testme.now');
$console->setArgument(2, 'I like it!');
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
->andReturn(true)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'add');
$console->setArgument(1, 'testme.now');
$txt = $this->dumpExecute($console);
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
->andReturn(true)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'add');
$console->setArgument(1, 'pod.ordoevangelistarum.com');
$console->setArgument(2, 'Other reason');
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
->andReturn(true)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'remove');
$console->setArgument(1, 'pod.ordoevangelistarum.com');
$txt = $this->dumpExecute($console);
*/
public function testBlockedServersWrongCommand()
{
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'wrongcommand');
$txt = $this->dumpExecute($console);
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'remove');
$console->setArgument(1, 'not.exiting');
$txt = $this->dumpExecute($console);
*/
public function testAddBlockedServerMissingArgument()
{
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'add');
$txt = $this->dumpExecute($console);
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
->andReturn(false)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'add');
$console->setArgument(1, 'testme.now');
$txt = $this->dumpExecute($console);
{
$this->configMock
->shouldReceive('get')
- ->with('system', 'blocklist')
+ ->with('system', 'blocklist', [])
->andReturn($this->defaultBlockList)
->once();
->andReturn(false)
->once();
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'remove');
$console->setArgument(1, 'pod.ordoevangelistarum.com');
$txt = $this->dumpExecute($console);
*/
public function testRemoveBlockedServerMissingArgument()
{
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setArgument(0, 'remove');
$txt = $this->dumpExecute($console);
*/
public function testBlockedServersHelp()
{
- $console = new ServerBlock($this->consoleArgv);
+ $console = new ServerBlock($this->configMock, $this->consoleArgv);
$console->setOption('help', true);
$txt = $this->dumpExecute($console);