Move activities test code

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
Christoph Wurst 2017-05-16 09:47:15 +02:00 committed by Roeland Jago Douma
parent 0928b5f621
commit 1632bb4557
No known key found for this signature in database
GPG key ID: F941078878347C0C
3 changed files with 24 additions and 24 deletions

View file

@ -20,19 +20,19 @@
*
*/
namespace OCA\TwoFactorBackupCodes\Test\Unit\Activity;
namespace Tests\Settings\Activity;
use OCA\TwoFactorBackupCodes\Activity\GenericFilter;
use OC\Settings\Activity\SecurityFilter;
use OCP\IL10N;
use OCP\IURLGenerator;
use Test\TestCase;
class GenericFilterTest extends TestCase {
class SecurityFilterTest extends TestCase {
private $urlGenerator;
private $l10n;
/** @var GenericFilter */
/** @var SecurityFilter */
private $filter;
protected function setUp() {
@ -41,7 +41,7 @@ class GenericFilterTest extends TestCase {
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->l10n = $this->createMock(IL10N::class);
$this->filter = new GenericFilter($this->urlGenerator, $this->l10n);
$this->filter = new SecurityFilter($this->urlGenerator, $this->l10n);
}
public function testAllowedApps() {
@ -49,7 +49,7 @@ class GenericFilterTest extends TestCase {
}
public function testFilterTypes() {
$this->assertEquals(['twofactor'], $this->filter->filterTypes(['comments', 'twofactor']));
$this->assertEquals(['security'], $this->filter->filterTypes(['comments', 'security']));
}
public function testGetIcon() {
@ -65,13 +65,13 @@ class GenericFilterTest extends TestCase {
}
public function testGetIdentifier() {
$this->assertEquals('twofactor', $this->filter->getIdentifier());
$this->assertEquals('security', $this->filter->getIdentifier());
}
public function testGetName() {
$this->l10n->expects($this->once())
->method('t')
->with('Two-factor authentication')
->with('Security')
->will($this->returnValue('translated'));
$this->assertEquals('translated', $this->filter->getName());
}

View file

@ -20,10 +20,10 @@
*
*/
namespace OCA\TwoFactorBackupCodes\Test\Unit\Activity;
namespace Tests\Settings\Activity;
use InvalidArgumentException;
use OCA\TwoFactorBackupCodes\Activity\GenericProvider;
use OC\Settings\Activity\SecurityProvider;
use OCP\Activity\IEvent;
use OCP\IL10N;
use OCP\ILogger;
@ -32,7 +32,7 @@ use OCP\L10N\IFactory;
use PHPUnit_Framework_MockObject_MockObject;
use Test\TestCase;
class GenericProviderTest extends TestCase {
class SecurityProviderTest extends TestCase {
/** @var IL10N|PHPUnit_Framework_MockObject_MockObject */
private $l10n;
@ -43,7 +43,7 @@ class GenericProviderTest extends TestCase {
/** @var ILogger|PHPUnit_Framework_MockObject_MockObject */
private $logger;
/** @var GenericProvider */
/** @var SecurityProvider */
private $provider;
protected function setUp() {
@ -53,7 +53,7 @@ class GenericProviderTest extends TestCase {
$this->urlGenerator = $this->createMock(IURLGenerator::class);
$this->logger = $this->createMock(ILogger::class);
$this->provider = new GenericProvider($this->l10n, $this->urlGenerator, $this->logger);
$this->provider = new SecurityProvider($this->l10n, $this->urlGenerator, $this->logger);
}
public function testParseUnrelated() {
@ -84,7 +84,7 @@ class GenericProviderTest extends TestCase {
$event->expects($this->once())
->method('getType')
->willReturn('twofactor');
->willReturn('security');
$this->l10n->expects($this->once())
->method('get')
->with('core', $lang)
@ -116,7 +116,7 @@ class GenericProviderTest extends TestCase {
$event->expects($this->once())
->method('getType')
->willReturn('twofactor');
->willReturn('security');
$this->l10n->expects($this->once())
->method('get')
->with('core', $lang)

View file

@ -20,17 +20,17 @@
*
*/
namespace OCA\TwoFactorBackupCodes\Test\Unit\Activity;
namespace Tests\Settings\Activity;
use OCA\TwoFactorBackupCodes\Activity\GenericSetting;
use OC\Settings\Activity\SecuritySetting;
use OCP\IL10N;
use Test\TestCase;
class SettingTest extends TestCase {
class SecuritySettingTest extends TestCase {
private $l10n;
/** @var GenericSetting */
/** @var SecuritySetting */
private $setting;
protected function setUp() {
@ -38,7 +38,7 @@ class SettingTest extends TestCase {
$this->l10n = $this->createMock(IL10N::class);
$this->setting = new GenericSetting($this->l10n);
$this->setting = new SecuritySetting($this->l10n);
}
public function testCanChangeMail() {
@ -50,15 +50,15 @@ class SettingTest extends TestCase {
}
public function testGetIdentifier() {
$this->assertEquals('twofactor', $this->setting->getIdentifier());
$this->assertEquals('security', $this->setting->getIdentifier());
}
public function testGetName() {
$this->l10n->expects($this->once())
->method('t')
->with('Two-factor authentication')
->will($this->returnValue('Zwei-Faktor-Authentifizierung'));
$this->assertEquals('Zwei-Faktor-Authentifizierung', $this->setting->getName());
->with('Security')
->will($this->returnValue('Sicherheit'));
$this->assertEquals('Sicherheit', $this->setting->getName());
}
public function testGetPriority() {