diff --git a/apps/files_external/img/app-dark.svg b/apps/files_external/img/app-dark.svg new file mode 100644 index 0000000000..157af238ee --- /dev/null +++ b/apps/files_external/img/app-dark.svg @@ -0,0 +1 @@ + diff --git a/apps/files_external/lib/Settings/Section.php b/apps/files_external/lib/Settings/Section.php index 4b4bac93d2..4829bb60d3 100644 --- a/apps/files_external/lib/Settings/Section.php +++ b/apps/files_external/lib/Settings/Section.php @@ -24,13 +24,21 @@ namespace OCA\Files_External\Settings; use OCP\IL10N; -use OCP\Settings\ISection; +use OCP\IURLGenerator; +use OCP\Settings\IIconSection; -class Section implements ISection { +class Section implements IIconSection { /** @var IL10N */ private $l; + /** @var IURLGenerator */ + private $url; - public function __construct(IL10N $l) { + /** + * @param IURLGenerator $url + * @param IL10N $l + */ + public function __construct(IURLGenerator $url, IL10N $l) { + $this->url = $url; $this->l = $l; } @@ -64,4 +72,11 @@ class Section implements ISection { public function getPriority() { return 10; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('files_external', 'app-dark.svg'); + } } diff --git a/apps/files_external/tests/Settings/SectionTest.php b/apps/files_external/tests/Settings/SectionTest.php index b5dfb28b38..ee501b1270 100644 --- a/apps/files_external/tests/Settings/SectionTest.php +++ b/apps/files_external/tests/Settings/SectionTest.php @@ -25,19 +25,24 @@ namespace OCA\Files_External\Tests\Settings; use OCA\Files_External\Settings\Section; use OCP\IL10N; +use OCP\IURLGenerator; use Test\TestCase; class SectionTest extends TestCase { /** @var IL10N */ private $l; + /** @var IURLGenerator */ + private $urlGenerator; /** @var Section */ private $section; public function setUp() { parent::setUp(); + $this->urlGenerator = $this->getMockBuilder('\OCP\IURLGenerator')->disableOriginalConstructor()->getMock(); $this->l = $this->getMockBuilder('\OCP\IL10N')->disableOriginalConstructor()->getMock(); $this->section = new Section( + $this->urlGenerator, $this->l ); } diff --git a/apps/theming/img/app-dark.svg b/apps/theming/img/app-dark.svg new file mode 100644 index 0000000000..adf97966c4 --- /dev/null +++ b/apps/theming/img/app-dark.svg @@ -0,0 +1 @@ + diff --git a/apps/theming/lib/Settings/Section.php b/apps/theming/lib/Settings/Section.php index cffbb8901c..6078743dea 100644 --- a/apps/theming/lib/Settings/Section.php +++ b/apps/theming/lib/Settings/Section.php @@ -24,13 +24,21 @@ namespace OCA\Theming\Settings; use OCP\IL10N; -use OCP\Settings\ISection; +use OCP\IURLGenerator; +use OCP\Settings\IIconSection; -class Section implements ISection { +class Section implements IIconSection { /** @var IL10N */ private $l; + /** @var IURLGenerator */ + private $url; - public function __construct(IL10N $l) { + /** + * @param IURLGenerator $url + * @param IL10N $l + */ + public function __construct(IURLGenerator $url, IL10N $l) { + $this->url = $url; $this->l = $l; } @@ -64,4 +72,11 @@ class Section implements ISection { public function getPriority() { return 30; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('theming', 'app-dark.svg'); + } } diff --git a/apps/theming/tests/Settings/SectionTest.php b/apps/theming/tests/Settings/SectionTest.php index 3a3a437523..90d1854aeb 100644 --- a/apps/theming/tests/Settings/SectionTest.php +++ b/apps/theming/tests/Settings/SectionTest.php @@ -25,19 +25,24 @@ namespace OCA\Theming\Tests\Settings; use OCA\Theming\Settings\Section; use OCP\IL10N; +use OCP\IURLGenerator; use Test\TestCase; class SectionTest extends TestCase { - /** @var IL10N */ + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + private $url; + /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l; /** @var Section */ private $section; public function setUp() { parent::setUp(); - $this->l = $this->getMockBuilder('\OCP\IL10N')->getMock(); + $this->url = $this->createMock(IURLGenerator::class); + $this->l = $this->createMock(IL10N::class); $this->section = new Section( + $this->url, $this->l ); } @@ -59,4 +64,13 @@ class SectionTest extends TestCase { public function testGetPriority() { $this->assertSame(30, $this->section->getPriority()); } + + public function testGetIcon() { + $this->url->expects($this->once()) + ->method('imagePath') + ->with('theming', 'app-dark.svg') + ->willReturn('icon'); + + $this->assertSame('icon', $this->section->getIcon()); + } } diff --git a/apps/user_ldap/lib/Settings/Section.php b/apps/user_ldap/lib/Settings/Section.php index 82d8d0c84f..a4106bacb9 100644 --- a/apps/user_ldap/lib/Settings/Section.php +++ b/apps/user_ldap/lib/Settings/Section.php @@ -24,13 +24,21 @@ namespace OCA\User_LDAP\Settings; use OCP\IL10N; -use OCP\Settings\ISection; +use OCP\IURLGenerator; +use OCP\Settings\IIconSection; -class Section implements ISection { +class Section implements IIconSection { /** @var IL10N */ private $l; + /** @var IURLGenerator */ + private $url; - public function __construct(IL10N $l) { + /** + * @param IURLGenerator $url + * @param IL10N $l + */ + public function __construct(IURLGenerator $url, IL10N $l) { + $this->url = $url; $this->l = $l; } @@ -64,4 +72,11 @@ class Section implements ISection { public function getPriority() { return 25; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('user_ldap', 'app.svg'); + } } diff --git a/apps/user_ldap/tests/Settings/SectionTest.php b/apps/user_ldap/tests/Settings/SectionTest.php index 2d2165b8e5..ae780dd766 100644 --- a/apps/user_ldap/tests/Settings/SectionTest.php +++ b/apps/user_ldap/tests/Settings/SectionTest.php @@ -25,19 +25,24 @@ namespace OCA\User_LDAP\Tests\Settings; use OCA\User_LDAP\Settings\Section; use OCP\IL10N; +use OCP\IURLGenerator; use Test\TestCase; class SectionTest extends TestCase { - /** @var IL10N */ + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + private $url; + /** @var IL10N|\PHPUnit_Framework_MockObject_MockObject */ private $l; /** @var Section */ private $section; public function setUp() { parent::setUp(); - $this->l = $this->getMockBuilder('\OCP\IL10N')->getMock(); + $this->url = $this->createMock(IURLGenerator::class); + $this->l = $this->createMock(IL10N::class); $this->section = new Section( + $this->url, $this->l ); } @@ -59,4 +64,13 @@ class SectionTest extends TestCase { public function testGetPriority() { $this->assertSame(25, $this->section->getPriority()); } + + public function testGetIcon() { + $this->url->expects($this->once()) + ->method('imagePath') + ->with('user_ldap', 'app.svg') + ->willReturn('icon'); + + $this->assertSame('icon', $this->section->getIcon()); + } } diff --git a/apps/workflowengine/lib/Settings/Section.php b/apps/workflowengine/lib/Settings/Section.php index df8bb80713..b46f9a4a35 100644 --- a/apps/workflowengine/lib/Settings/Section.php +++ b/apps/workflowengine/lib/Settings/Section.php @@ -24,13 +24,21 @@ namespace OCA\WorkflowEngine\Settings; use OCP\IL10N; -use OCP\Settings\ISection; +use OCP\IURLGenerator; +use OCP\Settings\IIconSection; -class Section implements ISection { +class Section implements IIconSection { /** @var IL10N */ private $l; + /** @var IURLGenerator */ + private $url; - public function __construct(IL10N $l) { + /** + * @param IURLGenerator $url + * @param IL10N $l + */ + public function __construct(IURLGenerator $url, IL10N $l) { + $this->url = $url; $this->l = $l; } @@ -54,4 +62,11 @@ class Section implements ISection { public function getPriority() { return 55; } + + /** + * {@inheritdoc} + */ + public function getIcon() { + return $this->url->imagePath('core', 'actions/tag.svg'); + } } diff --git a/core/css/apps.scss b/core/css/apps.scss index b88032340a..20d20fe977 100644 --- a/core/css/apps.scss +++ b/core/css/apps.scss @@ -104,6 +104,12 @@ em { opacity: 1; box-shadow: inset 2px 0 #0082c9; } + li > a:first-child img { + margin-bottom: -3px; + margin-right: 11px; + width: 16px; + margin-left: 2px; + } .collapse { display: none; /* hide collapse button initially */ diff --git a/core/img/actions/settings-dark.svg b/core/img/actions/settings-dark.svg new file mode 100644 index 0000000000..2160b673e3 --- /dev/null +++ b/core/img/actions/settings-dark.svg @@ -0,0 +1 @@ + diff --git a/lib/composer/composer/autoload_classmap.php b/lib/composer/composer/autoload_classmap.php index d0ca4646e5..84b5dc637b 100644 --- a/lib/composer/composer/autoload_classmap.php +++ b/lib/composer/composer/autoload_classmap.php @@ -225,6 +225,7 @@ return array( 'OCP\\Security\\ISecureRandom' => $baseDir . '/lib/public/Security/ISecureRandom.php', 'OCP\\Security\\StringUtils' => $baseDir . '/lib/public/Security/StringUtils.php', 'OCP\\Session\\Exceptions\\SessionNotAvailableException' => $baseDir . '/lib/public/Session/Exceptions/SessionNotAvailableException.php', + 'OCP\\Settings\\IIconSection' => $baseDir . '/lib/public/Settings/IIconSection.php', 'OCP\\Settings\\IManager' => $baseDir . '/lib/public/Settings/IManager.php', 'OCP\\Settings\\ISection' => $baseDir . '/lib/public/Settings/ISection.php', 'OCP\\Settings\\ISettings' => $baseDir . '/lib/public/Settings/ISettings.php', diff --git a/lib/composer/composer/autoload_static.php b/lib/composer/composer/autoload_static.php index 6fe9a95c24..01edabe688 100644 --- a/lib/composer/composer/autoload_static.php +++ b/lib/composer/composer/autoload_static.php @@ -255,6 +255,7 @@ class ComposerStaticInit53792487c5a8370acc0b06b1a864ff4c 'OCP\\Security\\ISecureRandom' => __DIR__ . '/../../..' . '/lib/public/Security/ISecureRandom.php', 'OCP\\Security\\StringUtils' => __DIR__ . '/../../..' . '/lib/public/Security/StringUtils.php', 'OCP\\Session\\Exceptions\\SessionNotAvailableException' => __DIR__ . '/../../..' . '/lib/public/Session/Exceptions/SessionNotAvailableException.php', + 'OCP\\Settings\\IIconSection' => __DIR__ . '/../../..' . '/lib/public/Settings/IIconSection.php', 'OCP\\Settings\\IManager' => __DIR__ . '/../../..' . '/lib/public/Settings/IManager.php', 'OCP\\Settings\\ISection' => __DIR__ . '/../../..' . '/lib/public/Settings/ISection.php', 'OCP\\Settings\\ISettings' => __DIR__ . '/../../..' . '/lib/public/Settings/ISettings.php', diff --git a/lib/private/Server.php b/lib/private/Server.php index d88a687bbc..8528d5e7b3 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -792,7 +792,8 @@ class Server extends ServerContainer implements IServerContainer { $c->getEncryptionManager(), $c->getUserManager(), $c->getLockingProvider(), - new \OC\Settings\Mapper($c->getDatabaseConnection()) + new \OC\Settings\Mapper($c->getDatabaseConnection()), + $c->getURLGenerator() ); return $manager; }); diff --git a/lib/private/Settings/Manager.php b/lib/private/Settings/Manager.php index 949826aa24..7a339b9419 100644 --- a/lib/private/Settings/Manager.php +++ b/lib/private/Settings/Manager.php @@ -29,6 +29,7 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Lock\ILockingProvider; use OCP\Settings\ISettings; @@ -55,6 +56,8 @@ class Manager implements IManager { private $userManager; /** @var ILockingProvider */ private $lockingProvider; + /** @var IURLGenerator */ + private $url; /** * @param ILogger $log @@ -65,7 +68,7 @@ class Manager implements IManager { * @param IUserManager $userManager * @param ILockingProvider $lockingProvider * @param Mapper $mapper - * @internal param IDBConnection $dbc + * @param IURLGenerator $url */ public function __construct( ILogger $log, @@ -75,7 +78,8 @@ class Manager implements IManager { EncryptionManager $encryptionManager, IUserManager $userManager, ILockingProvider $lockingProvider, - Mapper $mapper + Mapper $mapper, + IURLGenerator $url ) { $this->log = $log; $this->dbc = $dbc; @@ -85,6 +89,7 @@ class Manager implements IManager { $this->encryptionManager = $encryptionManager; $this->userManager = $userManager; $this->lockingProvider = $lockingProvider; + $this->url = $url; } /** @@ -260,11 +265,11 @@ class Manager implements IManager { public function getAdminSections() { // built-in sections $sections = [ - 0 => [new Section('server', $this->l->t('Server settings'), 0)], - 5 => [new Section('sharing', $this->l->t('Sharing'), 0)], - 45 => [new Section('encryption', $this->l->t('Encryption'), 0)], - 98 => [new Section('additional', $this->l->t('Additional settings'), 0)], - 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0)], + 0 => [new Section('server', $this->l->t('Server settings'), 0, $this->url->imagePath('settings', 'admin.svg'))], + 5 => [new Section('sharing', $this->l->t('Sharing'), 0, $this->url->imagePath('core', 'actions/share.svg'))], + 45 => [new Section('encryption', $this->l->t('Encryption'), 0, $this->url->imagePath('core', 'actions/password.svg'))], + 98 => [new Section('additional', $this->l->t('Additional settings'), 0, $this->url->imagePath('core', 'actions/settings-dark.svg'))], + 99 => [new Section('tips-tricks', $this->l->t('Tips & tricks'), 0, $this->url->imagePath('settings', 'help.svg'))], ]; $rows = $this->mapper->getAdminSectionsFromDB(); diff --git a/lib/private/Settings/Section.php b/lib/private/Settings/Section.php index b3cf242279..c89a3999c4 100644 --- a/lib/private/Settings/Section.php +++ b/lib/private/Settings/Section.php @@ -23,25 +23,29 @@ namespace OC\Settings; -use OCP\Settings\ISection; +use OCP\Settings\IIconSection; -class Section implements ISection { +class Section implements IIconSection { /** @var string */ private $id; /** @var string */ private $name; /** @var int */ private $priority; + /** @var string */ + private $icon; /** * @param string $id * @param string $name * @param int $priority + * @param string $icon */ - public function __construct($id, $name, $priority) { + public function __construct($id, $name, $priority, $icon = '') { $this->id = $id; $this->name = $name; $this->priority = $priority; + $this->icon = $icon; } /** @@ -74,4 +78,15 @@ class Section implements ISection { public function getPriority() { return $this->priority; } + + /** + * returns the relative path to an 16*16 icon describing the section. + * e.g. '/core/img/places/files.svg' + * + * @returns string + * @since 12 + */ + public function getIcon() { + return $this->icon; + } } diff --git a/lib/public/Settings/IIconSection.php b/lib/public/Settings/IIconSection.php new file mode 100644 index 0000000000..089b9b094e --- /dev/null +++ b/lib/public/Settings/IIconSection.php @@ -0,0 +1,38 @@ + + * + * @author Joas Schilling + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace OCP\Settings; + +/** + * @since 12 + */ +interface IIconSection extends ISection { + /** + * returns the relative path to an 16*16 icon describing the section. + * e.g. '/core/img/places/files.svg' + * + * @returns string + * @since 12 + */ + public function getIcon(); +} diff --git a/lib/public/Settings/ISection.php b/lib/public/Settings/ISection.php index 5edf5de0ca..3c08b74bdc 100644 --- a/lib/public/Settings/ISection.php +++ b/lib/public/Settings/ISection.php @@ -24,6 +24,7 @@ namespace OCP\Settings; /** + * @deprecated 12 Use IIconSection instead * @since 9.1 */ interface ISection { diff --git a/settings/Controller/AdminSettingsController.php b/settings/Controller/AdminSettingsController.php index ef70caf569..4bc986e708 100644 --- a/settings/Controller/AdminSettingsController.php +++ b/settings/Controller/AdminSettingsController.php @@ -28,7 +28,9 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http\TemplateResponse; use OCP\INavigationManager; use OCP\IRequest; +use OCP\Settings\IIconSection; use OCP\Settings\IManager as ISettingsManager; +use OCP\Settings\ISection; use OCP\Template; /** @@ -133,10 +135,16 @@ class AdminSettingsController extends Controller { /** @var \OC\Settings\Section[] $prioritizedSections */ foreach($sections as $prioritizedSections) { foreach ($prioritizedSections as $section) { + $icon = ''; + if ($section instanceof IIconSection) { + $icon = $section->getIcon(); + } + $templateParameters[] = [ 'anchor' => $section->getID(), 'section-name' => $section->getName(), 'active' => $section->getID() === $currentSection, + 'icon' => $icon, ]; } } diff --git a/settings/css/settings.css b/settings/css/settings.css index 72e740d9a0..aa5e8cd75b 100644 --- a/settings/css/settings.css +++ b/settings/css/settings.css @@ -7,6 +7,29 @@ input#openid, input#webdav { width:20em; } /* PERSONAL */ +/* icons for sidebar */ +.nav-icon-personal-settings { + background-image: url('../img/personal.svg?v=1'); +} +.nav-icon-sessions { + background-image: url('../img/toggle-filelist.svg?v=1'); +} +.nav-icon-apppasswords { + background-image: url('../img/password.svg?v=1'); +} +.nav-icon-clientsbox { + background-image: url('../img/change.svg?v=1'); +} +.nav-icon-activity { + background-image: url('../img/activity-dark.svg?v=1'); +} +.nav-icon-federated-cloud { + background-image: url('../img/share.svg?v=1'); +} +.nav-icon-second-factor-backup-codes { + background-image: url('../img/password.svg?v=1'); +} + #avatarform { width: 160px; padding-right: 0; @@ -713,6 +736,17 @@ table.grid td.date{ } /* ADMIN */ + +/* Navigation icons */ +#app-navigation img { + margin-bottom: -3px; + margin-right: 6px; + width: 16px; +} +#app-navigation li span.no-icon { + padding-left: 25px; +} + #security-warning li { list-style: initial; margin: 10px 0; diff --git a/settings/img/activity-dark.svg b/settings/img/activity-dark.svg new file mode 100644 index 0000000000..0fccc55228 --- /dev/null +++ b/settings/img/activity-dark.svg @@ -0,0 +1,4 @@ + + + + diff --git a/settings/img/change.svg b/settings/img/change.svg new file mode 100644 index 0000000000..cbc5d982b3 --- /dev/null +++ b/settings/img/change.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/settings/img/password.svg b/settings/img/password.svg new file mode 100644 index 0000000000..3d161917f6 --- /dev/null +++ b/settings/img/password.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/img/share.svg b/settings/img/share.svg new file mode 100644 index 0000000000..68f2100e49 --- /dev/null +++ b/settings/img/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/img/toggle-filelist.svg b/settings/img/toggle-filelist.svg new file mode 100644 index 0000000000..47f019057e --- /dev/null +++ b/settings/img/toggle-filelist.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/settings/templates/admin/frame.php b/settings/templates/admin/frame.php index 761d76c443..2b234f4cd9 100644 --- a/settings/templates/admin/frame.php +++ b/settings/templates/admin/frame.php @@ -30,14 +30,28 @@ script('files', 'jquery.fileupload');
    - getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]); + $class = 'nav-icon-' . $form['anchor']; $sectionName = $form['section-name']; $active = $form['active'] ? ' class="active"' : ''; - print_unescaped(sprintf("%s", $active, \OCP\Util::sanitizeHTML($anchor), \OCP\Util::sanitizeHTML($sectionName))); + ?> +
  • > + + + + + + + + +
  • + + } + ?>
diff --git a/settings/templates/personal.php b/settings/templates/personal.php index a14982b9b7..d3a835c4a1 100644 --- a/settings/templates/personal.php +++ b/settings/templates/personal.php @@ -9,12 +9,14 @@ ?>
-
    +
      %s", \OCP\Util::sanitizeHTML($anchor), \OCP\Util::sanitizeHTML($sectionName))); + print_unescaped(sprintf("
    • %s
    • ", \OCP\Util::sanitizeHTML($anchor), + \OCP\Util::sanitizeHTML($class), \OCP\Util::sanitizeHTML($sectionName))); } }?>
    diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index b91331a1d3..70401abb65 100644 --- a/tests/lib/Settings/ManagerTest.php +++ b/tests/lib/Settings/ManagerTest.php @@ -32,6 +32,7 @@ use OCP\IConfig; use OCP\IDBConnection; use OCP\IL10N; use OCP\ILogger; +use OCP\IURLGenerator; use OCP\IUserManager; use OCP\Lock\ILockingProvider; use Test\TestCase; @@ -55,18 +56,21 @@ class ManagerTest extends TestCase { private $lockingProvider; /** @var Mapper|\PHPUnit_Framework_MockObject_MockObject */ private $mapper; + /** @var IURLGenerator|\PHPUnit_Framework_MockObject_MockObject */ + private $url; public function setUp() { parent::setUp(); - $this->logger = $this->getMockBuilder('\OCP\ILogger')->getMock(); - $this->dbConnection = $this->getMockBuilder('\OCP\IDBConnection')->getMock(); - $this->l10n = $this->getMockBuilder('\OCP\IL10N')->getMock(); - $this->config = $this->getMockBuilder('\OCP\IConfig')->getMock(); - $this->encryptionManager = $this->getMockBuilder('\OCP\Encryption\IManager')->getMock(); - $this->userManager = $this->getMockBuilder('\OCP\IUserManager')->getMock(); - $this->lockingProvider = $this->getMockBuilder('\OCP\Lock\ILockingProvider')->getMock(); - $this->mapper = $this->getMockBuilder(Mapper::class)->disableOriginalConstructor()->getMock(); + $this->logger = $this->createMock(ILogger::class); + $this->dbConnection = $this->createMock(IDBConnection::class); + $this->l10n = $this->createMock(IL10N::class); + $this->config = $this->createMock(IConfig::class); + $this->encryptionManager = $this->createMock(IManager::class); + $this->userManager = $this->createMock(IUserManager::class); + $this->lockingProvider = $this->createMock(ILockingProvider::class); + $this->mapper = $this->createMock(Mapper::class); + $this->url = $this->createMock(IURLGenerator::class); $this->manager = new Manager( $this->logger, @@ -76,7 +80,8 @@ class ManagerTest extends TestCase { $this->encryptionManager, $this->userManager, $this->lockingProvider, - $this->mapper + $this->mapper, + $this->url ); } @@ -133,22 +138,26 @@ class ManagerTest extends TestCase { $this->mapper->expects($this->once()) ->method('getAdminSectionsFromDB') ->will($this->returnValue([ - ['class' => '\OCA\LogReader\Settings\Section', 'priority' => 90] + ['class' => \OCA\WorkflowEngine\Settings\Section::class, 'priority' => 90] ])); - $this->mapper->expects($this->once()) - ->method('getAdminSettingsCountFromDB') - ->will($this->returnValue([ - 'logging' => 1 - ])); + $this->url->expects($this->exactly(5)) + ->method('imagePath') + ->willReturnMap([ + ['settings', 'admin.svg', '1'], + ['core', 'actions/share.svg', '2'], + ['core', 'actions/password.svg', '3'], + ['core', 'actions/settings-dark.svg', '4'], + ['settings', 'help.svg', '5'], + ]); $this->assertEquals([ - 0 => [new Section('server', 'Server settings', 0)], - 5 => [new Section('sharing', 'Sharing', 0)], - 45 => [new Section('encryption', 'Encryption', 0)], - 90 => [new \OCA\LogReader\Settings\Section(\OC::$server->getL10N('logreader'))], - 98 => [new Section('additional', 'Additional settings', 0)], - 99 => [new Section('tips-tricks', 'Tips & tricks', 0)], + 0 => [new Section('server', 'Server settings', 0, '1')], + 5 => [new Section('sharing', 'Sharing', 0, '2')], + 45 => [new Section('encryption', 'Encryption', 0, '3')], + 90 => [\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')], ], $this->manager->getAdminSections()); } @@ -161,19 +170,24 @@ class ManagerTest extends TestCase { $this->mapper->expects($this->once()) ->method('getAdminSectionsFromDB') ->will($this->returnValue([ - ['class' => '\OCA\LogReader\Settings\Section', 'priority' => 90] ])); - $this->mapper->expects($this->once()) - ->method('getAdminSettingsCountFromDB') - ->will($this->returnValue([])); + $this->url->expects($this->exactly(5)) + ->method('imagePath') + ->willReturnMap([ + ['settings', 'admin.svg', '1'], + ['core', 'actions/share.svg', '2'], + ['core', 'actions/password.svg', '3'], + ['core', 'actions/settings-dark.svg', '4'], + ['settings', 'help.svg', '5'], + ]); $this->assertEquals([ - 0 => [new Section('server', 'Server settings', 0)], - 5 => [new Section('sharing', 'Sharing', 0)], - 45 => [new Section('encryption', 'Encryption', 0)], - 98 => [new Section('additional', 'Additional settings', 0)], - 99 => [new Section('tips-tricks', 'Tips & tricks', 0)], + 0 => [new Section('server', 'Server settings', 0, '1')], + 5 => [new Section('sharing', 'Sharing', 0, '2')], + 45 => [new Section('encryption', 'Encryption', 0, '3')], + 98 => [new Section('additional', 'Additional settings', 0, '4')], + 99 => [new Section('tips-tricks', 'Tips & tricks', 0, '5')], ], $this->manager->getAdminSections()); }