diff options
author | Joas Schilling <coding@schilljs.com> | 2017-01-19 15:30:40 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-01-19 15:30:40 +0100 |
commit | 5812e99f1d403428316235063e215f4bf6231c04 (patch) | |
tree | 380cfd5d0b723cf8c385d0949a3c7ae7d5e48f00 /apps | |
parent | 80b800128d93e26ba7b06279ed6ef6f3a2f00651 (diff) | |
download | nextcloud-server-5812e99f1d403428316235063e215f4bf6231c04.tar.gz nextcloud-server-5812e99f1d403428316235063e215f4bf6231c04.zip |
Fix app section tests
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/theming/tests/Settings/SectionTest.php | 18 | ||||
-rw-r--r-- | apps/user_ldap/tests/Settings/SectionTest.php | 18 |
2 files changed, 32 insertions, 4 deletions
diff --git a/apps/theming/tests/Settings/SectionTest.php b/apps/theming/tests/Settings/SectionTest.php index 3a3a4375236..90d1854aebf 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/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()); + } } |