Test listing folder types.
authorGunnar Wrobel <p@rdus.de>
Mon, 27 Dec 2010 21:12:35 +0000 (22:12 +0100)
committerGunnar Wrobel <p@rdus.de>
Tue, 4 Jan 2011 07:54:16 +0000 (08:54 +0100)
framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/Driver/MockTest.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/BaseTest.php
framework/Kolab_Storage/test/Horde/Kolab/Storage/Unit/List/Decorator/LogTest.php

index 94c4f3b..ad74cbd 100644 (file)
@@ -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();
index dc27dbe..693829a 100644 (file)
@@ -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()
+        );
+    }
+
 }
index ab26a02..71f3eb8 100644 (file)
@@ -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.');
+    }
 }