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 /tests | |
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 'tests')
-rw-r--r-- | tests/lib/Settings/ManagerTest.php | 74 |
1 files changed, 44 insertions, 30 deletions
diff --git a/tests/lib/Settings/ManagerTest.php b/tests/lib/Settings/ManagerTest.php index b91331a1d30..70401abb652 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()); } |