Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mock/stub for the prefix generator.
Fixes first round of test failures, and allows another set to fail :)
- Loading branch information
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
framework/Kolab_Storage/test/Horde/Kolab/Storage/Stub/HistoryPrefix.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* History system prefix generator for use with Kolab_Storage. | ||
* | ||
* @author Thomas Jarosch <thomas.jarosch@intra2net.com> | ||
* @author Michael J Rubinsky <mrubinsk@horde.org> | ||
* @category Horde | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @link http://pear.horde.org/index.php?package=Kolab_Storage | ||
*/ | ||
|
||
/** | ||
* @author Thomas Jarosch <thomas.jarosch@intra2net.com> | ||
* @author Michael J Rubinsky <mrubinsk@horde.org> | ||
* @category Horde | ||
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1 | ||
* @link http://pear.horde.org/index.php?package=Kolab_Storage | ||
*/ | ||
class Horde_Kolab_Storage_Stub_HistoryPrefix | ||
implements Horde_Kolab_Storage_HistoryPrefix | ||
{ | ||
/** | ||
* Mock mapping. Basically the stock Horde app mapping. | ||
* | ||
* @var array | ||
*/ | ||
protected static $_map = array( | ||
'contact' => 'turba', | ||
'event' => 'kronolith', | ||
'note' => 'mnemo', | ||
'task' => 'nag' | ||
); | ||
|
||
/** | ||
* Generate a prefix for the History system for the given Kolab data. | ||
* | ||
* @param Horde_Kolab_Storage_Data $data The data object. | ||
* | ||
* @return string The History prefix. | ||
*/ | ||
public static function getPrefix(Horde_Kolab_Storage_Data $data) | ||
{ | ||
$app = self::$_map[$data->getType()]; | ||
|
||
return empty($app) | ||
? false | ||
: sprintf('%s:internal_id:', $app); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters