Skip to content

Commit

Permalink
Adapt Kolab Horde_History unit test to new id prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjfox authored and mrubinsk committed Jun 5, 2015
1 parent 9efe5be commit d00c195
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 12 deletions.
Expand Up @@ -7,6 +7,7 @@
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel <wrobel@pardus.de>
* @author Thomas Jarosch <thomas.jarosch@intra2net.com>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
Expand All @@ -22,6 +23,7 @@
* @category Kolab
* @package Kolab_Storage
* @author Gunnar Wrobel <wrobel@pardus.de>
* @author Thomas Jarosch <thomas.jarosch@intra2net.com>
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @link http://pear.horde.org/index.php?package=Kolab_Storage
*/
Expand All @@ -35,7 +37,7 @@ public function testSynchronize()
1,
count(
$this->history->getHistory(
'20080626155721.771268tms63o0rs4@devmail.example.com'
'mnemo:internal_id:ABC1234'
)
)
);
Expand All @@ -46,8 +48,8 @@ public function testAdded()
$this->_getDataQuery();
$this->assertEquals(
array(
'20080626155721.771268tms63o0rs4@devmail.example.com' => 1,
'20090731103253.11391snjudt9zgpw@webmail.example.com' => 2
'mnemo:internal_id:ABC1234' => 1,
'mnemo:internal_id:DEF5678' => 2
),
$this->history->getByTimestamp(
'>',
Expand All @@ -65,11 +67,13 @@ public function testAdded()

public function testSingleAdd()
{
// TODO: What is the purpose of this test exactly?
// It looks pretty identical to the test above.
$this->_getDataQuery()->synchronize();
$this->assertEquals(
array(
'20080626155721.771268tms63o0rs4@devmail.example.com' => 1,
'20090731103253.11391snjudt9zgpw@webmail.example.com' => 2
'mnemo:internal_id:ABC1234' => 1,
'mnemo:internal_id:DEF5678' => 2
),
$this->history->getByTimestamp(
'>',
Expand All @@ -88,11 +92,12 @@ public function testSingleAdd()
public function testModify()
{
$data = $this->_getData();
$o = $data->getObject('20090731103253.11391snjudt9zgpw@webmail.example.com');
$o = $data->getObject('DEF5678');
$data->modify($o);

$this->assertEquals(
array(
'20090731103253.11391snjudt9zgpw@webmail.example.com' => 3
'mnemo:internal_id:DEF5678' => 3
),
$this->history->getByTimestamp(
'>',
Expand All @@ -111,10 +116,11 @@ public function testModify()
public function testDelete()
{
$data = $this->_getData();
$data->delete('20090731103253.11391snjudt9zgpw@webmail.example.com');
$data->delete('ABC1234');

$this->assertEquals(
array(
'20090731103253.11391snjudt9zgpw@webmail.example.com' => 3
'mnemo:internal_id:ABC1234' => 3
),
$this->history->getByTimestamp(
'>',
Expand Down Expand Up @@ -148,16 +154,32 @@ private function _getFolder()
$this->getDataAccount(
array(
'user/test/History' => array(
't' => 'h-prefs.default',
'a' => array(
'/shared/vendor/kolab/folder-type' => 'note.default',
'/shared/vendor/horde/share-params' => base64_encode(serialize(array('share_name' => 'internal_id')))
),
'm' => array(
1 => array('file' => __DIR__ . '/../../../../fixtures/preferences.1'),
2 => array('file' => __DIR__ . '/../../../../fixtures/preferences.2'),
1 => array('file' => __DIR__ . '/../../../../fixtures/note.eml'),
2 => array('file' => __DIR__ . '/../../../../fixtures/note2.eml'),
),
)
)
),
array(
'queryset' => array('data' => array('queryset' => 'horde')),
'queries' => array(
'list' => array(
Horde_Kolab_Storage_List_Tools::QUERY_BASE => array(
'cache' => false
),
Horde_Kolab_Storage_List_Tools::QUERY_ACL => array(
'cache' => false
),
Horde_Kolab_Storage_List_Tools::QUERY_SHARE => array(
'cache' => false
),
)
),
'history' => $this->history
)
);
Expand Down
@@ -0,0 +1,42 @@
From: user
To: user
Date: Tue, 11 Sep 2012 09:06:04 +0200
Subject: DEF5678
User-Agent: Horde::Kolab::Storage v@version@
MIME-Version: 1.0
X-Kolab-Type: application/x-vnd.kolab.note
Content-Type: multipart/mixed; name="Kolab Groupware Data";
boundary="=_23WLX7vgjhlQTuLb6j00EAA"
Content-Disposition: attachment; filename="Kolab Groupware Data"

This message is in MIME format.

--=_23WLX7vgjhlQTuLb6j00EAA
Content-Type: text/plain; name="Kolab Groupware Information"; charset=utf-8
Content-Disposition: inline; filename="Kolab Groupware Information"
This is a Kolab Groupware object. To view this object you will need an email
client that understands the Kolab Groupware format. For a list of such email
clients please visit http://www.kolab.org/content/kolab-clients
--=_23WLX7vgjhlQTuLb6j00EAA
Content-Type: application/x-vnd.kolab.note; name=kolab.xml
Content-Disposition: inline; x-kolab-type=xml; filename=kolab.xml
Content-Transfer-Encoding: quoted-printable
<?xml version=3D"1.0" encoding=3D"UTF-8"?>
<note version=3D"1.0">
<uid>DEF5678</uid>
<body></body>
<categories></categories>
<creation-date>2012-09-11T09:06:04Z</creation-date>
<last-modification-date>2012-09-11T07:06:04Z</last-modification-date>
<sensitivity>public</sensitivity>
<product-id>Horde_Kolab_Format_Xml-@version@ (api version: 2)</product-id=
>
<summary>TEST2</summary>
<x-test>other client</x-test>
<background-color>#000000</background-color>
<foreground-color>#ffff00</foreground-color>
</note>
--=_23WLX7vgjhlQTuLb6j00EAA--

0 comments on commit d00c195

Please sign in to comment.