From 1632bb45573b5294da97b8c157799b6a44624caa Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Tue, 16 May 2017 09:47:15 +0200 Subject: [PATCH] Move activities test code Signed-off-by: Christoph Wurst --- .../Settings/Activity/SecurityFilterTest.php | 16 ++++++++-------- .../Settings/Activity/SecurityProviderTest.php | 14 +++++++------- .../Settings/Activity/SecuritySettingTest.php | 18 +++++++++--------- 3 files changed, 24 insertions(+), 24 deletions(-) rename apps/twofactor_backupcodes/tests/Unit/Activity/GenericFilterTest.php => tests/Settings/Activity/SecurityFilterTest.php (81%) rename apps/twofactor_backupcodes/tests/Unit/Activity/GenericProviderTest.php => tests/Settings/Activity/SecurityProviderTest.php (90%) rename apps/twofactor_backupcodes/tests/Unit/Activity/SettingTest.php => tests/Settings/Activity/SecuritySettingTest.php (76%) diff --git a/apps/twofactor_backupcodes/tests/Unit/Activity/GenericFilterTest.php b/tests/Settings/Activity/SecurityFilterTest.php similarity index 81% rename from apps/twofactor_backupcodes/tests/Unit/Activity/GenericFilterTest.php rename to tests/Settings/Activity/SecurityFilterTest.php index ca24c0be647..44345b83fa5 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Activity/GenericFilterTest.php +++ b/tests/Settings/Activity/SecurityFilterTest.php @@ -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()); } diff --git a/apps/twofactor_backupcodes/tests/Unit/Activity/GenericProviderTest.php b/tests/Settings/Activity/SecurityProviderTest.php similarity index 90% rename from apps/twofactor_backupcodes/tests/Unit/Activity/GenericProviderTest.php rename to tests/Settings/Activity/SecurityProviderTest.php index 242c4ab4e8d..2abc14654f1 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Activity/GenericProviderTest.php +++ b/tests/Settings/Activity/SecurityProviderTest.php @@ -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) diff --git a/apps/twofactor_backupcodes/tests/Unit/Activity/SettingTest.php b/tests/Settings/Activity/SecuritySettingTest.php similarity index 76% rename from apps/twofactor_backupcodes/tests/Unit/Activity/SettingTest.php rename to tests/Settings/Activity/SecuritySettingTest.php index 2f6aed040f0..4e9ce1a0897 100644 --- a/apps/twofactor_backupcodes/tests/Unit/Activity/SettingTest.php +++ b/tests/Settings/Activity/SecuritySettingTest.php @@ -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() { -- 2.39.5