diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-05-07 12:29:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-07 12:29:53 +0200 |
commit | d161d4473edbd80272ff36991186c9b1f19204ad (patch) | |
tree | 7980d13e99942e92f04c05d5b450c6a04cac8f94 /tests | |
parent | 94010e91d1075c0a67380bfcc881a2564e6e0b0f (diff) | |
parent | ea8e80c20ba2a2f4d6547a184ccc0358fa42940c (diff) | |
download | nextcloud-server-d161d4473edbd80272ff36991186c9b1f19204ad.tar.gz nextcloud-server-d161d4473edbd80272ff36991186c9b1f19204ad.zip |
Merge pull request #9029 from nextcloud/settings-restructure
Restructure server settings
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Settings/Admin/MailTest.php (renamed from tests/lib/Settings/Admin/AdditionalTest.php) | 9 | ||||
-rw-r--r-- | tests/lib/Settings/Admin/ServerTest.php | 53 | ||||
-rw-r--r-- | tests/lib/Settings/ManagerTest.php | 30 |
3 files changed, 23 insertions, 69 deletions
diff --git a/tests/lib/Settings/Admin/AdditionalTest.php b/tests/lib/Settings/Admin/MailTest.php index 4a254da060b..04c0e7fa92e 100644 --- a/tests/lib/Settings/Admin/AdditionalTest.php +++ b/tests/lib/Settings/Admin/MailTest.php @@ -24,11 +24,12 @@ namespace Test\Settings\Admin; use OC\Settings\Admin\Additional; +use OC\Settings\Admin\Mail; use OCP\AppFramework\Http\TemplateResponse; use OCP\IConfig; use Test\TestCase; -class AdditionalTest extends TestCase { +class MailTest extends TestCase { /** @var Additional */ private $admin; /** @var IConfig */ @@ -38,7 +39,7 @@ class AdditionalTest extends TestCase { parent::setUp(); $this->config = $this->getMockBuilder(IConfig::class)->getMock(); - $this->admin = new Additional( + $this->admin = new Mail( $this->config ); } @@ -118,10 +119,10 @@ class AdditionalTest extends TestCase { } public function testGetSection() { - $this->assertSame('additional', $this->admin->getSection()); + $this->assertSame('server', $this->admin->getSection()); } public function testGetPriority() { - $this->assertSame(0, $this->admin->getPriority()); + $this->assertSame(10, $this->admin->getPriority()); } } diff --git a/tests/lib/Settings/Admin/ServerTest.php b/tests/lib/Settings/Admin/ServerTest.php index b8317540117..a121abc3df2 100644 --- a/tests/lib/Settings/Admin/ServerTest.php +++ b/tests/lib/Settings/Admin/ServerTest.php @@ -65,74 +65,25 @@ class ServerTest extends TestCase { } public function testGetForm() { - $this->dbConnection - ->expects($this->once()) - ->method('getDatabasePlatform') - ->willReturn(new SqlitePlatform()); $this->config ->expects($this->at(0)) - ->method('getSystemValue') - ->with('overwrite.cli.url', '') - ->willReturn(true); - $this->config - ->expects($this->at(2)) ->method('getAppValue') ->with('core', 'backgroundjobs_mode', 'ajax') ->willReturn('ajax'); $this->config - ->expects($this->at(3)) + ->expects($this->at(1)) ->method('getAppValue') ->with('core', 'lastcron', false) ->willReturn(false); $this->config - ->expects($this->at(4)) + ->expects($this->at(2)) ->method('getAppValue') ->with('core', 'cronErrors') ->willReturn(''); - $this->config - ->expects($this->at(1)) - ->method('getSystemValue') - ->with('check_for_working_wellknown_setup', true) - ->willReturn(true); - $this->l10n - ->expects($this->at(0)) - ->method('t') - ->with('APCu') - ->willReturn('APCu'); - $this->l10n - ->expects($this->at(1)) - ->method('t') - ->with('Redis') - ->willReturn('Redis'); - $outdatedCaches = []; - $caches = [ - 'apcu' => ['name' => 'APCu', 'version' => '4.0.6'], - 'redis' => ['name' => 'Redis', 'version' => '2.2.5'], - ]; - foreach ($caches as $php_module => $data) { - $isOutdated = extension_loaded($php_module) && version_compare(phpversion($php_module), $data['version'], '<'); - if ($isOutdated) { - $outdatedCaches[$php_module] = $data; - } - } - $envPath = getenv('PATH'); $expected = new TemplateResponse( 'settings', 'settings/admin/server', [ - // Diagnosis - 'readOnlyConfigEnabled' => \OC_Helper::isReadOnlyConfigEnabled(), - 'isLocaleWorking' => \OC_Util::isSetLocaleWorking(), - 'isAnnotationsWorking' => \OC_Util::isAnnotationsWorking(), - 'checkForWorkingWellKnownSetup' => true, - 'has_fileinfo' => \OC_Util::fileInfoLoaded(), - 'invalidTransactionIsolationLevel' => false, - 'getenvServerNotWorking' => empty($envPath), - 'OutdatedCacheWarning' => $outdatedCaches, - 'fileLockingType' => 'cache', - 'suggestedOverwriteCliUrl' => '', - - // Background jobs 'backgroundjobs_mode' => 'ajax', 'lastcron' => false, 'cronErrors' => '', diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index b218a347e85..d51a57598b3 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -115,24 +115,25 @@ class ManagerTest extends TestCase { $this->manager->registerSection('admin', \OCA\WorkflowEngine\Settings\Section::class); - $this->url->expects($this->exactly(6)) + $this->url->expects($this->exactly(7)) ->method('imagePath') ->willReturnMap([ - ['settings', 'admin.svg', '1'], + ['settings', 'admin.svg', '0'], + ['core', 'actions/settings-dark.svg', '1'], ['core', 'actions/share.svg', '2'], ['core', 'actions/password.svg', '3'], - ['core', 'actions/settings-dark.svg', '4'], - ['settings', 'help.svg', '5'], + ['settings', 'help.svg', '4'], ]); $this->assertEquals([ - 0 => [new Section('server', 'Basic settings', 0, '1')], + 0 => [new Section('overview', 'Overview', 0, '0')], + 1 => [new Section('server', 'Basic settings', 0, '1')], 5 => [new Section('sharing', 'Sharing', 0, '2')], 10 => [new Section('security', 'Security', 0, '3')], 45 => [new Section('encryption', 'Encryption', 0, '3')], 55 => [\OC::$server->query(\OCA\WorkflowEngine\Settings\Section::class)], - 98 => [new Section('additional', 'Additional settings', 0, '4')], - 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '5')], + 98 => [new Section('additional', 'Additional settings', 0, '1')], + 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '4')], ], $this->manager->getAdminSections()); } @@ -166,23 +167,24 @@ class ManagerTest extends TestCase { ->method('t') ->will($this->returnArgument(0)); - $this->url->expects($this->exactly(6)) + $this->url->expects($this->exactly(7)) ->method('imagePath') ->willReturnMap([ - ['settings', 'admin.svg', '1'], + ['settings', 'admin.svg', '0'], + ['core', 'actions/settings-dark.svg', '1'], ['core', 'actions/share.svg', '2'], ['core', 'actions/password.svg', '3'], - ['core', 'actions/settings-dark.svg', '4'], - ['settings', 'help.svg', '5'], + ['settings', 'help.svg', '4'], ]); $this->assertEquals([ - 0 => [new Section('server', 'Basic settings', 0, '1')], + 0 => [new Section('overview', 'Overview', 0, '0')], + 1 => [new Section('server', 'Basic settings', 0, '1')], 5 => [new Section('sharing', 'Sharing', 0, '2')], 10 => [new Section('security', 'Security', 0, '3')], 45 => [new Section('encryption', 'Encryption', 0, '3')], - 98 => [new Section('additional', 'Additional settings', 0, '4')], - 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '5')], + 98 => [new Section('additional', 'Additional settings', 0, '1')], + 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '4')], ], $this->manager->getAdminSections()); } |