From 163fdee55ea89c27dbcd6d6e118448ca72d83505 Mon Sep 17 00:00:00 2001 From: Gunnar Wrobel Date: Mon, 27 Dec 2010 22:12:35 +0100 Subject: [PATCH] Test listing folder types. --- .../Horde/Kolab/Storage/Unit/Driver/MockTest.php | 46 ++++++++++++++++++++++ .../Horde/Kolab/Storage/Unit/List/BaseTest.php | 21 ++++++++++ .../Kolab/Storage/Unit/List/Decorator/LogTest.php | 24 ++++++++++- 3 files changed, 89 insertions(+), 2 deletions(-) diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/Driver/MockTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/Driver/MockTest.php index 94c4f3bc4..ad74cbd21 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/Driver/MockTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/Driver/MockTest.php @@ -53,6 +53,52 @@ extends Horde_Kolab_Storage_TestCase ); } + public function testListAnnotationReturnsArray() + { + $this->assertType( + 'array', + $this->getNullMock()->listAnnotation( + '/shared/vendor/kolab/folder-type' + ) + ); + } + + public function testListAnnotationSize() + { + $this->assertEquals( + 4, + count( + $this->getAnnotatedMock()->listAnnotation( + '/shared/vendor/kolab/folder-type' + ) + ) + ); + } + + public function testListAnnotationKeys() + { + $this->assertEquals( + array('INBOX/Calendar', 'INBOX/Contacts', 'INBOX/Notes', 'INBOX/Tasks'), + array_keys( + $this->getAnnotatedMock()->listAnnotation( + '/shared/vendor/kolab/folder-type' + ) + ) + ); + } + + public function testListAnnotationGermanKeys() + { + $this->assertEquals( + array('INBOX/Kalender', 'INBOX/Kontakte', 'INBOX/Notizen', 'INBOX/Aufgaben'), + array_keys( + $this->getGermanAnnotatedMock()->listAnnotation( + '/shared/vendor/kolab/folder-type' + ) + ) + ); + } + public function testGetAnnotationReturnsAnnotationValue() { $this->markTestIncomplete(); diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php index dc27dbe49..693829a72 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php @@ -49,4 +49,25 @@ extends Horde_Kolab_Storage_TestCase $list->listFolders() ); } + + public function testTypeReturnsArray() + { + $list = new Horde_Kolab_Storage_List_Base($this->getNullMock()); + $this->assertType('array', $list->listTypes()); + } + + public function testTypeReturnsAnnotations() + { + $list = new Horde_Kolab_Storage_List_Base($this->getAnnotatedMock()); + $this->assertEquals( + array( + 'INBOX/Calendar' => 'event.default', + 'INBOX/Contacts' => 'contact.default', + 'INBOX/Notes' => 'note.default', + 'INBOX/Tasks' => 'task.default', + ), + $list->listTypes() + ); + } + } diff --git a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php index ab26a0288..71f3eb8ef 100644 --- a/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php +++ b/framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php @@ -35,7 +35,7 @@ require_once dirname(__FILE__) . '/../../../Autoload.php'; class Horde_Kolab_Storage_Unit_List_Decorator_LogTest extends Horde_Kolab_Storage_TestCase { - public function testListLogsEntry() + public function testListFolderCount() { $list = new Horde_Kolab_Storage_List_Decorator_Log( new Horde_Kolab_Storage_List_Base($this->getNullMock()), @@ -45,7 +45,7 @@ extends Horde_Kolab_Storage_TestCase $this->assertLogCount(2); } - public function testListFolderCount() + public function testListLogsEntry() { $list = new Horde_Kolab_Storage_List_Decorator_Log( new Horde_Kolab_Storage_List_Base($this->getTwoFolderMock()), @@ -54,4 +54,24 @@ extends Horde_Kolab_Storage_TestCase $list->listFolders(); $this->assertLogContains('List contained 2 folders.'); } + + public function testListTypesFolderCount() + { + $list = new Horde_Kolab_Storage_List_Decorator_Log( + new Horde_Kolab_Storage_List_Base($this->getNullMock()), + $this->getMockLogger() + ); + $list->listTypes(); + $this->assertLogCount(2); + } + + public function testListTypesLogsEntry() + { + $list = new Horde_Kolab_Storage_List_Decorator_Log( + new Horde_Kolab_Storage_List_Base($this->getAnnotatedMock()), + $this->getMockLogger() + ); + $list->listtypes(); + $this->assertLogContains('List contained 4 folders and types.'); + } } -- 2.11.0