mirror of
https://github.com/friendica/friendica
synced 2025-04-27 13:50:12 +00:00
Make server domain pattern block reason mandatory
This commit is contained in:
parent
e35651c44a
commit
97ccb4d2c4
3 changed files with 25 additions and 45 deletions
|
@ -93,25 +93,6 @@ CONS;
|
|||
self::assertEquals('The domain pattern \'testme.now\' is now blocked. (Reason: \'I like it!\')' . "\n", $txt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test blockedservers add command with the default reason
|
||||
*/
|
||||
public function testAddBlockedServerWithDefaultReason()
|
||||
{
|
||||
$this->blocklistMock
|
||||
->shouldReceive('addPattern')
|
||||
->with('testme.now', DomainPatternBlocklist::DEFAULT_REASON)
|
||||
->andReturn(1)
|
||||
->once();
|
||||
|
||||
$console = new ServerBlock($this->blocklistMock, $this->consoleArgv);
|
||||
$console->setArgument(0, 'add');
|
||||
$console->setArgument(1, 'testme.now');
|
||||
$txt = $this->dumpExecute($console);
|
||||
|
||||
self::assertEquals('The domain pattern \'testme.now\' is now blocked. (Reason: \'' . DomainPatternBlocklist::DEFAULT_REASON . '\')' . "\n", $txt);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test blockedservers add command on existed domain
|
||||
*/
|
||||
|
@ -170,16 +151,16 @@ CONS;
|
|||
{
|
||||
$this->blocklistMock
|
||||
->shouldReceive('removePattern')
|
||||
->with('not.exiting')
|
||||
->with('not.existing')
|
||||
->andReturn(1)
|
||||
->once();
|
||||
|
||||
$console = new ServerBlock($this->blocklistMock, $this->consoleArgv);
|
||||
$console->setArgument(0, 'remove');
|
||||
$console->setArgument(1, 'not.exiting');
|
||||
$console->setArgument(1, 'not.existing');
|
||||
$txt = $this->dumpExecute($console);
|
||||
|
||||
self::assertEquals('The domain pattern \'not.exiting\' wasn\'t blocked.' . "\n", $txt);
|
||||
self::assertEquals('The domain pattern \'not.existing\' wasn\'t blocked.' . "\n", $txt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -191,7 +172,14 @@ CONS;
|
|||
$console->setArgument(0, 'add');
|
||||
$txt = $this->dumpExecute($console);
|
||||
|
||||
self::assertStringStartsWith('[Warning] Add needs a domain pattern and optionally a reason.', $txt);
|
||||
self::assertStringStartsWith('[Warning] Add needs a domain pattern and a reason.', $txt);
|
||||
|
||||
$console = new ServerBlock($this->blocklistMock, $this->consoleArgv);
|
||||
$console->setArgument(0, 'add');
|
||||
$console->setArgument(1, 'testme.now');
|
||||
$txt = $this->dumpExecute($console);
|
||||
|
||||
self::assertStringStartsWith('[Warning] Add needs a domain pattern and a reason.', $txt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -201,13 +189,14 @@ CONS;
|
|||
{
|
||||
$this->blocklistMock
|
||||
->shouldReceive('addPattern')
|
||||
->with('testme.now', DomainPatternBlocklist::DEFAULT_REASON)
|
||||
->with('testme.now', 'I like it!')
|
||||
->andReturn(0)
|
||||
->once();
|
||||
|
||||
$console = new ServerBlock($this->blocklistMock, $this->consoleArgv);
|
||||
$console->setArgument(0, 'add');
|
||||
$console->setArgument(1, 'testme.now');
|
||||
$console->setArgument(2, 'I like it!');
|
||||
$txt = $this->dumpExecute($console);
|
||||
|
||||
self::assertEquals('Couldn\'t save \'testme.now\' as blocked domain pattern' . "\n", $txt);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue