*/
static public function factory($script, $params = array())
{
- $script = basename($script);
- $class = 'Ingo_Script_' . ucfirst($script);
+ $script = Horde_String::ucfirst(basename($script));
+ $class = 'Ingo_Script_' . $script;
if (!isset($params['spam_compare'])) {
$params['spam_compare'] = $GLOBALS['conf']['spam']['compare'];
if (!isset($params['spam_char'])) {
$params['spam_char'] = $GLOBALS['conf']['spam']['char'];
}
- if ($script == 'sieve') {
+ if (!isset($params['charset'])) {
+ $params['charset'] = Horde_Nls::getCharset();
+ }
+ if ($script == 'Sieve') {
if (!isset($params['date_format'])) {
$params['date_format'] = $GLOBALS['prefs']->getValue('date_format');;
}
foreach ($overview as $msg) {
$GLOBALS['notification']->push(
sprintf(_("Filter activity: The message \"%s\" from \"%s\" has been moved to the folder \"%s\"."),
- !empty($msg['envelope']['subject']) ? Horde_Mime::decode($msg['envelope']['subject'], Horde_Nls::getCharset()) : _("[No Subject]"),
- !empty($msg['envelope']['from']) ? Horde_Mime::decode(Horde_Mime_Address::addrArray2String($msg['envelope']['from']), Horde_Nls::getCharset()) : _("[No Sender]"),
- Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', Horde_Nls::getCharset())),
+ !empty($msg['envelope']['subject']) ? Horde_Mime::decode($msg['envelope']['subject'], $this->_params['charset']) : _("[No Subject]"),
+ !empty($msg['envelope']['from']) ? Horde_Mime::decode(Horde_Mime_Address::addrArray2String($msg['envelope']['from']), $this->_params['charset']) : _("[No Sender]"),
+ Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', $this->_params['charset'])),
'horde.message');
}
} else {
$GLOBALS['notification']->push(sprintf(_("Filter activity: %s message(s) have been moved to the folder \"%s\"."),
count($indices),
- Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', Horde_Nls::getCharset())), 'horde.message');
+ Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', $this->_params['charset'])), 'horde.message');
}
} elseif ($rule['action'] == Ingo_Storage::ACTION_DISCARD) {
/* We need to grab the overview first. */
foreach ($overview as $msg) {
$GLOBALS['notification']->push(
sprintf(_("Filter activity: The message \"%s\" from \"%s\" has been deleted."),
- !empty($msg['envelope']['subject']) ? Horde_Mime::decode($msg['envelope']['subject'], Horde_Nls::getCharset()) : _("[No Subject]"),
- !empty($msg['envelope']['from']) ? Horde_Mime::decode($msg['envelope']['from'], Horde_Nls::getCharset()) : _("[No Sender]")),
+ !empty($msg['envelope']['subject']) ? Horde_Mime::decode($msg['envelope']['subject'], $this->_params['charset']) : _("[No Subject]"),
+ !empty($msg['envelope']['from']) ? Horde_Mime::decode($msg['envelope']['from'], $this->_params['charset']) : _("[No Sender]")),
'horde.message');
}
} else {
foreach ($overview as $msg) {
$GLOBALS['notification']->push(
sprintf(_("Filter activity: The message \"%s\" from \"%s\" has been copied to the folder \"%s\"."),
- !empty($msg['envelope']['subject']) ? Horde_Mime::decode($msg['envelope']['subject'], Horde_Nls::getCharset()) : _("[No Subject]"),
- !empty($msg['envelope']['from']) ? Horde_Mime::decode($msg['envelope']['from'], Horde_Nls::getCharset()) : _("[No Sender]"),
- Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', Horde_Nls::getCharset())),
+ !empty($msg['envelope']['subject']) ? Horde_Mime::decode($msg['envelope']['subject'], $this->_params['charset']) : _("[No Subject]"),
+ !empty($msg['envelope']['from']) ? Horde_Mime::decode($msg['envelope']['from'], $this->_params['charset']) : _("[No Sender]"),
+ Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', $this->_params['charset'])),
'horde.message');
}
} else {
- $GLOBALS['notification']->push(sprintf(_("Filter activity: %s message(s) have been copied to the folder \"%s\"."), count($indices), Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', Horde_Nls::getCharset())), 'horde.message');
+ $GLOBALS['notification']->push(sprintf(_("Filter activity: %s message(s) have been copied to the folder \"%s\"."), count($indices), Horde_String::convertCharset($rule['action-value'], 'UTF7-IMAP', $this->_params['charset'])), 'horde.message');
}
}
}
$dh = opendir($dir);
while (($dent = readdir($dh)) !== false) {
if (!in_array($dent, array('.', '..'))) {
- $this->_fixtures[$dent] = Horde_Mime_Part::parseHeaders(file_get_contents($dir . '/' . $dent));
+ $this->_fixtures[$dent] = Horde_Mime_Headers::parseHeaders(file_get_contents($dir . '/' . $dent));
}
}
closedir($dh);
}
/**
- * TODO
+ * @todo The new Horde_Imap library *only* does server-side searches now,
+ * so we can't use Horde_Imap_Client_Search_Query for mock searches
+ * anymore.
*/
- public function search(&$query)
+ public function search($query)
{
$result = array();
foreach ($this->_folders['INBOX'] as $message) {
*/
function generate()
{
- $filters = &$GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_FILTERS);
+ $filters = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_FILTERS);
$this->addItem(new Maildrop_Comment(_("maildrop script generated by Ingo") . ' (' . date('F j, Y, g:i a') . ')'));
}
// Writing vacation.msg file
- $reason = Horde_Mime::encode($params['action-value']['reason'], Horde_Nls::getCharset());
+ $reason = Horde_Mime::encode($params['action-value']['reason'], $scriptparams['charset']);
$driver = Ingo::getDriver();
$driver->_connect();
$result = $driver->_vfs->writeData($driver->_params['vfs_path'], 'vacation.msg', $reason, true);
$this->_action[] = ' ($current_time <= ' . $end . ')) ';
$this->_action[] = ' {';
}
- $this->_action[] = " cc \"| mailbot -D " . $params['action-value']['days'] . " -c '" . Horde_Nls::getCharset() . "' -t \$HOME/vacation.msg -d \$HOME/vacation -A 'From: $from' -s '" . Horde_Mime::encode($params['action-value']['subject'], Horde_Nls::getCharset()) . "' /usr/sbin/sendmail -t \"";
+ $this->_action[] = " cc \"| mailbot -D " . $params['action-value']['days'] . " -c '" . $scriptparams['charset'] . "' -t \$HOME/vacation.msg -d \$HOME/vacation -A 'From: $from' -s '" . Horde_Mime::encode($params['action-value']['subject'], $scriptparams['charset']) . "' /usr/sbin/sendmail -t \"";
if (($start != 0) && ($end !== 0)) {
$this->_action[] = ' }';
$this->_action[] = ' }';
*/
function generate()
{
- $filters = &$GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_FILTERS);
+ $filters = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_FILTERS);
$this->addItem(new Procmail_Comment(_("procmail script generated by Ingo") . ' (' . date('F j, Y, g:i a') . ')'));
$this->_action[] = ' -a"From: <' . $address . '>" \\';
$this->_action[] = ' -A"X-Loop: ' . $address . '" \\';
if (Horde_Mime::is8bit($params['action-value']['reason'])) {
- $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" \\';
+ $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', $scriptparams['charset']) . '" \\';
$this->_action[] = ' -i"Content-Transfer-Encoding: quoted-printable" \\';
- $this->_action[] = ' -i"Content-Type: text/plain; charset=' . Horde_Nls::getCharset() . '" ; \\';
+ $this->_action[] = ' -i"Content-Type: text/plain; charset=' . $scriptparams['charset'] . '" ; \\';
$reason = Horde_Mime::quotedPrintableEncode($params['action-value']['reason'], "\n");
} else {
- $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', Horde_Nls::getCharset()) . '" ; \\';
+ $this->_action[] = ' -i"Subject: ' . Horde_Mime::encode($params['action-value']['subject'] . ' (Re: $SUBJECT)', $scriptparams['charset']) . '" ; \\';
$reason = $params['action-value']['reason'];
}
$reason = addcslashes($reason, "\\\n\r\t\"`");
. _("Generated by Ingo (http://www.horde.org/ingo/)") . ' ('
. trim(strftime($this->_params['date_format'] . ', ' . $this->_params['time_format']))
. ")\n\n";
- $code = Horde_String::convertCharset($code, Horde_Nls::getCharset(), 'UTF-8');
+ $code = $this->encode($code);
$requires = $this->requires();
if (count($requires) > 1) {
}
/**
+ * Encodes a string to UTF-8.
+ *
+ * @param string $string The string to encode.
+ *
+ * @return string The string, UTF-8 encoded.
+ */
+ function encode($string)
+ {
+ return Horde_String::convertCharset($string, $this->_params['charset'], 'UTF-8');
+ }
+
+ /**
* Escape a string according to Sieve RFC 3028 [2.4.2].
*
* @param string $string The string to escape.
if (count($action)) {
if($forward->getForwardKeep()) {
- $this->_endBlocks[] = new Sieve_Comment(_("Forward Keep Action"));
+ $this->_endBlocks[] = new Sieve_Comment($this->encode(_("Forward Keep Action")));
$if = new Sieve_If(new Sieve_Test_True());
$if->setActions(array(new Sieve_Action_Keep(),
new Sieve_Action_Stop()));
}
}
- $this->_blocks[] = new Sieve_Comment(_("Forwards"));
+ $this->_blocks[] = new Sieve_Comment($this->encode(_("Forwards")));
$test = new Sieve_Test_True();
$if = new Sieve_If($test);
$action = array();
if (empty($folder)) {
$action[] = new Sieve_Action_Discard();
- } elseif ($folder == INGO_BLACKLIST_MARKER) {
+ } elseif ($folder == Ingo::BLACKLIST_MARKER) {
$action[] = new Sieve_Action_Addflag(array('flags' => Ingo_Storage::FLAG_DELETED));
$action[] = new Sieve_Action_Keep();
$action[] = new Sieve_Action_Removeflag(array('flags' => Ingo_Storage::FLAG_DELETED));
$action[] = new Sieve_Action_Stop();
- $this->_blocks[] = new Sieve_Comment(_("Blacklisted Addresses"));
+ $this->_blocks[] = new Sieve_Comment($this->encode(_("Blacklisted Addresses")));
/* Split the test up to only do 5 addresses at a time. */
$temp = array();
return;
}
- $whitelist = &$GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_WHITELIST);
+ $whitelist = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_WHITELIST);
$wl_addr = $whitelist->getWhitelist();
if (empty($wl_addr)) {
return;
}
- $this->_blocks[] = new Sieve_Comment(_("Whitelisted Addresses"));
+ $this->_blocks[] = new Sieve_Comment($this->encode(_("Whitelisted Addresses")));
$action = array(new Sieve_Action_Keep(), new Sieve_Action_Stop());
$test = new Sieve_Test_Address(array('headers' => "From\nSender\nResent-From", 'addresses' => implode("\n", $wl_addr)));
return;
}
- $vacation = &$GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_VACATION);
+ $vacation = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_VACATION);
$vacation_addr = $vacation->getVacationAddresses();
if (!count($vacation_addr)) {
return;
}
$vals = array(
- 'subject' => Horde_String::convertCharset($vacation->getVacationSubject(), Horde_Nls::getCharset(), 'UTF-8'),
+ 'subject' => $this->encode($vacation->getVacationSubject()),
'days' => $vacation->getVacationDays(),
'addresses' => $vacation_addr,
'start' => $vacation->getVacationStart(),
'end_year' => $vacation->getVacationEndYear(),
'end_month' => $vacation->getVacationEndMonth(),
'end_day' => $vacation->getVacationEndDay(),
- 'reason' => Horde_String::convertCharset($vacation->getVacationReason(), Horde_Nls::getCharset(), 'UTF-8'),
+ 'reason' => $this->encode($vacation->getVacationReason()),
);
$action = $tests = array();
$tests[] = new Sieve_Test_Not($tmp);
}
- $this->_blocks[] = new Sieve_Comment(_("Vacation"));
+ $this->_blocks[] = new Sieve_Comment($this->encode(_("Vacation")));
if ($tests) {
$test = new Sieve_Test_Allof($tests);
return;
}
- $this->_blocks[] = new Sieve_Comment(_("Spam Filter"));
+ $this->_blocks[] = new Sieve_Comment($this->encode(_("Spam Filter")));
$actions = array();
$actions[] = new Sieve_Action_Fileinto(array_merge($this->_params, array('folder' => $spam->getSpamFolder())));
{
global $ingo_storage;
- $filters = &$ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
+ $filters = $ingo_storage->retrieve(Ingo_Storage::ACTION_FILTERS);
foreach ($filters->getFilterList() as $filter) {
/* Check to make sure this is a valid rule and that the rule
is not disabled. */
continue 2;
}
- $this->_blocks[] = new Sieve_Comment($filter['name']);
+ $this->_blocks[] = new Sieve_Comment($this->encode($filter['name']));
if ($filter['stop']) {
$action[] = new Sieve_Action_Stop();
$code .= (empty($code) ? '' : "\n") . '# ' . $line;
}
}
- return Horde_String::convertCharset($code, Horde_Nls::getCharset(), 'UTF-8');
+ return $code;
}
/**
*/
public function setBlacklist($data, $sort = true)
{
- $addr = &$this->_addressList($data, $sort);
+ $addr = $this->_addressList($data, $sort);
if (!empty($GLOBALS['conf']['storage']['maxblacklist'])) {
$addr_count = count($addr);
if ($addr_count > $GLOBALS['conf']['storage']['maxblacklist']) {
public function setForwardAddresses($data, $sort = true)
{
- $this->_addr = &$this->_addressList($data, $sort);
+ $this->_addr = $this->_addressList($data, $sort);
}
public function setForwardKeep($data)
{
protected $_data = array();
- protected function &_retrieve($field)
+ protected function _retrieve($field)
{
if (empty($this->_data[$field])) {
switch ($field) {
return new Ingo_Storage_Forward();
case self::ACTION_VACATION:
- return new Ingo_Storage_Vacation();
+ return new Ingo_Storage_VacationTest();
case self::ACTION_WHITELIST:
return new Ingo_Storage_Whitelist();
public function setVacationAddresses($data, $sort = true)
{
- $this->_addr = &$this->_addressList($data, $sort);
+ $this->_addr = $this->_addressList($data, $sort);
}
public function setVacationDays($data)
public function setVacationExcludes($data, $sort = true)
{
- $this->_excludes = &$this->_addressList($data, $sort);
+ $this->_excludes = $this->_addressList($data, $sort);
}
public function setVacationIgnorelist($data)
--- /dev/null
+<?php
+/**
+ * Ingo_Storage_Vacation_Test overrides certain Ingo_Storage_Vacation
+ * functionality to help with unit testing.
+ *
+ * See the enclosed file LICENSE for license information (ASL). If you
+ * did not receive this file, see http://www.horde.org/licenses/asl.php.
+ *
+ * @author Michael Slusarz <slusarz@horde.org>
+ * @package Ingo
+ */
+class Ingo_Storage_VacationTest extends Ingo_Storage_Vacation
+{
+ public function getVacationAddresses()
+ {
+ return $this->_addr;
+ }
+}
*/
public function setWhitelist($data, $sort = true)
{
- $addr = &$this->_addressList($data, $sort);
+ $addr = $this->_addressList($data, $sort);
$addr = array_filter($addr, array('Ingo', 'filterEmptyAddress'));
if (!empty($GLOBALS['conf']['storage']['maxwhitelist'])) {
$addr_count = count($addr);
--- /dev/null
+<?php
+/**
+ * @category Horde
+ * @package Ingo
+ * @subpackage UnitTests
+ * @copyright 2009 The Horde Project (http://www.horde.org/)
+ * @license http://www.fsf.org/copyleft/lgpl.html
+ */
+
+/**
+ * Define the main method
+ */
+if (!defined('PHPUnit_MAIN_METHOD')) {
+ define('PHPUnit_MAIN_METHOD', 'Ingo_AllTests::main');
+}
+
+/**
+ * Prepare the test setup.
+ */
+@define('INGO_BASE', dirname(__FILE__) . '/../..');
+require_once 'Horde/Autoloader.php';
+date_default_timezone_set('Europe/Berlin');
+
+/**
+ * @package Horde_Icalendar
+ * @subpackage UnitTests
+ */
+class Ingo_AllTests extends Horde_Test_AllTests
+{
+ /**
+ * Collect the unit tests of this directory into a new suite.
+ *
+ * @return PHPUnit_Framework_TestSuite The test suite.
+ */
+ public static function suite()
+ {
+ // Catch strict standards
+ error_reporting(E_ALL);
+
+ // Set up autoload
+ $basedir = dirname(__FILE__);
+ Horde_Autoloader::addClassPattern('/^Ingo(?:$|_)/', $basedir . '/../');
+
+ $suite = new PHPUnit_Framework_TestSuite('Ingo');
+ $baseregexp = preg_quote($basedir . DIRECTORY_SEPARATOR, '/');
+
+ foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($basedir)) as $file) {
+ if ($file->isFile() && preg_match('/Test.php$/', $file->getFilename())) {
+ $pathname = $file->getPathname();
+ require $pathname;
+
+ $class = str_replace(DIRECTORY_SEPARATOR, '_',
+ preg_replace("/^$baseregexp(.*)\.php/", '\\1', $pathname));
+ $suite->addTestSuite('Ingo_' . $class);
+ }
+ }
+
+ return $suite;
+ }
+}
+
+if (PHPUnit_MAIN_METHOD == 'Ingo_AllTests::main') {
+ Ingo_AllTests::main('Ingo', __FILE__);
+}
$GLOBALS['ingo_script'] = Ingo_Script::factory(
'maildrop',
array('path_style' => 'mbox',
+ 'charset' => 'UTF-8',
'spam_compare' => 'string',
'spam_header' => 'X-Spam-Level',
'spam_char' => '*'));
function testForwardKeep()
{
- $forward = new Ingo_Storage_forward();
+ $forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(true);
function testForwardNoKeep()
{
- $forward = new Ingo_Storage_forward();
+ $forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(false);
function testBlacklistWithFolder()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder('Junk');
function testBlacklistMarker()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER);
function testBlacklistDiscard()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(null);
function testWhitelist()
{
- $wl = new Ingo_Storage_whitelist(3);
+ $wl = new Ingo_Storage_Whitelist(3);
$wl->setWhitelist(array('spammer@example.com'));
$this->store($wl);
$GLOBALS['ingo_script'] = Ingo_Script::factory(
'procmail',
array('path_style' => 'mbox',
+ 'charset' => 'UTF-8',
'spam_compare' => 'string',
'spam_header' => 'X-Spam-Level',
'spam_char' => '*'));
function testForwardKeep()
{
- $forward = new Ingo_Storage_forward();
+ $forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(true);
function testForwardNoKeep()
{
- $forward = new Ingo_Storage_forward();
+ $forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(false);
function testBlacklistWithFolder()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder('Junk');
function testBlacklistMarker()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER);
function testBlacklistDiscard()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(null);
function testWhitelist()
{
- $wl = new Ingo_Storage_whitelist(3);
+ $wl = new Ingo_Storage_Whitelist(3);
$wl->setWhitelist(array('spammer@example.com'));
$this->store($wl);
function testVacationDisabled()
{
- $vacation = new Ingo_Storage_vacation();
+ $vacation = new Ingo_Storage_VacationTest();
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");
function testVacationEnabled()
{
- $vacation = new Ingo_Storage_vacation();
+ $vacation = new Ingo_Storage_VacationTest();
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");
{
$runner = ScriptTester::factory('all', $this);
- $ob = new Ingo_Storage_blacklist();
+ $ob = new Ingo_Storage_Blacklist();
$ob->setBlacklist(array('spammer@example.com'));
$ob->setBlacklistFolder('');
$runner->addRule($ob);
{
$runner = ScriptTester::factory('all', $this);
- $bl = new Ingo_Storage_blacklist();
+ $bl = new Ingo_Storage_Blacklist();
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder('');
$runner->addRule($bl);
- $wl = new Ingo_Storage_whitelist();
+ $wl = new Ingo_Storage_Whitelist();
$wl->setWhitelist(array('spammer@example.com'));
$runner->addRule($wl);
{
$runner = ScriptTester::factory('all', $this);
- $ob = new Ingo_Storage_blacklist();
+ $ob = new Ingo_Storage_Blacklist();
$ob->setBlacklist(array('spammer@example.com'));
$ob->setBlacklistFolder('Junk');
$runner->addRule($ob);
{
$runner = ScriptTester::factory('all', $this);
- $bl = new Ingo_Storage_blacklist();
+ $bl = new Ingo_Storage_Blacklist();
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder('');
$runner->addRule($bl);
- $wl = new Ingo_Storage_whitelist();
+ $wl = new Ingo_Storage_Whitelist();
$wl->setWhitelist(array('ammer@example.com'));
$runner->addRule($wl);
{
$runner = ScriptTester::factory('all', $this);
- $bl = new Ingo_Storage_blacklist();
+ $bl = new Ingo_Storage_Blacklist();
$bl->setBlacklist(array('ammer@example.com'));
$bl->setBlacklistFolder('');
$runner->addRule($bl);
return PEAR::raiseError('Not implemented.');
}
- function factory($type, $test)
+ static function factory($type, $test)
{
$class = 'ScriptTester_' . $type;
$ob = new $class($test);
function _setup()
{
$this->_setupStorage();
- $this->api = Ingo_Script_imap_api::factory('mock', array());
-
- $result = $this->api->loadFixtures(dirname(__FILE__) . '/_data/');
- $this->test->assertNotType('PEAR_Error', $result);
+ $this->api = Ingo_Script_Imap_Api::factory('mock', array());
+ $this->api->loadFixtures(dirname(__FILE__) . '/_data/');
$GLOBALS['notification'] = new Ingo_Test_Notification;
- $params = array('api' => $this->api);
+ $params = array('api' => $this->api,
+ 'charset' => 'UTF-8',
+ 'spam_compare' => 'string',
+ 'spam_header' => 'X-Spam-Level',
+ 'spam_char' => '*');
$this->imap = Ingo_Script::factory('imap', $params);
}
*/
class ScriptTester_all extends ScriptTester {
- var $backends = array('imap', 'sieve');
+ // No imap tests for now, until the mock searching works again.
+ var $backends = array('sieve');
function _delegate($method, $params)
{
function _writeSieveScript()
{
- $params = array('date_format' => '%x', 'time_format' => '%R');
+ $params = array('date_format' => '%x',
+ 'time_format' => '%R',
+ 'charset' => 'UTF-8',
+ 'spam_compare' => 'string',
+ 'spam_header' => 'X-Spam-Level',
+ 'spam_char' => '*');
$this->_setupStorage();
$script = Ingo_Script::factory('sieve', $params);
'maxwhitelist' => 3));
$GLOBALS['ingo_script'] = Ingo_Script::factory(
'sieve',
- array('spam_compare' => 'string',
+ array('charset' => 'UTF-8',
+ 'spam_compare' => 'string',
'spam_header' => 'X-Spam-Level',
'spam_char' => '*',
'date_format' => '%x',
function testForwardKeep()
{
- $forward = new Ingo_Storage_forward();
+ $forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(true);
function testForwardNoKeep()
{
- $forward = new Ingo_Storage_forward();
+ $forward = new Ingo_Storage_Forward();
$forward->setForwardAddresses('joefabetes@example.com');
$forward->setForwardKeep(false);
function testBlacklistMarker()
{
- $bl = new Ingo_Storage_blacklist(3);
+ $bl = new Ingo_Storage_Blacklist(3);
$bl->setBlacklist(array('spammer@example.com'));
$bl->setBlacklistFolder(Ingo::BLACKLIST_MARKER);
function testWhitelist()
{
- $wl = new Ingo_Storage_whitelist(3);
+ $wl = new Ingo_Storage_Whitelist(3);
$wl->setWhitelist(array('spammer@example.com'));
$this->store($wl);
function testVacationDisabled()
{
- $vacation = new Ingo_Storage_vacation();
+ $vacation = new Ingo_Storage_VacationTest();
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");
function testVacationEnabled()
{
- $vacation = new Ingo_Storage_vacation();
+ $vacation = new Ingo_Storage_VacationTest();
$vacation->setVacationAddresses(array('from@example.com'));
$vacation->setVacationSubject('Subject');
$vacation->setVacationReason("Because I don't like working!");
function testSpamDisabled()
{
- $spam = new Ingo_Storage_spam();
+ $spam = new Ingo_Storage_Spam();
$spam->setSpamLevel(7);
$spam->setSpamFolder("Junk");
function testSpamEnabled()
{
- $spam = new Ingo_Storage_spam();
+ $spam = new Ingo_Storage_Spam();
$spam->setSpamLevel(7);
$spam->setSpamFolder("Junk");
<?php
-
-define('INGO_BASE', dirname(__FILE__) . '/../..');
-define('HORDE_BASE', dirname(__FILE__) . '/../../..');
-require_once HORDE_BASE . '/lib/core.php';
-
/**
* Common library for Ingo test cases
*