diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-01-24 10:56:31 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-01-24 10:56:31 -0600 |
commit | e09bba5e366d14223c1326ac4a08cf3e5904612a (patch) | |
tree | 824ddc7166e002b46bea6f1cff916785603c2494 /apps/user_ldap | |
parent | f55260bc83feeb76ae662c7b97d092da83d8b6bb (diff) | |
parent | 38f684aadfb10d491fabfeb0af9a22c109c9cfff (diff) | |
download | nextcloud-server-e09bba5e366d14223c1326ac4a08cf3e5904612a.tar.gz nextcloud-server-e09bba5e366d14223c1326ac4a08cf3e5904612a.zip |
Merge pull request #3151 from nextcloud/navigation-icons
add icons to navigation of personal & admin settings
Diffstat (limited to 'apps/user_ldap')
-rw-r--r-- | apps/user_ldap/lib/Settings/Section.php | 21 | ||||
-rw-r--r-- | apps/user_ldap/tests/Settings/SectionTest.php | 18 |
2 files changed, 34 insertions, 5 deletions
diff --git a/apps/user_ldap/lib/Settings/Section.php b/apps/user_ldap/lib/Settings/Section.php index 82d8d0c84fa..a4106bacb9e 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 2d2165b8e56..ae780dd7665 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()); + } } |