Overview

Packages

  • Horde
    • Icalendar
      • UnitTests
  • Ingo
    • UnitTests
  • None

Classes

  • Ingo_Application
  • Ingo_Block_Overview
  • Ingo_Script_Imap_Mock
  • Ingo_Test_Notification
  • ScriptTester
  • ScriptTester_all
  • ScriptTester_imap
  • ScriptTester_sieve
  • Overview
  • Package
  • Class
  • Tree
 1: <?php
 2: /**
 3:  * Common library for Ingo test cases
 4:  *
 5:  * See the enclosed file LICENSE for license information (ASL).  If you
 6:  * did not receive this file, see http://www.horde.org/licenses/asl.php.
 7:  *
 8:  * @author  Jason M. Felice <jason.m.felice@gmail.com>
 9:  * @package Ingo
10:  * @subpackage UnitTests
11:  */
12: class Ingo_TestBase extends PHPUnit_Framework_TestCase {
13: 
14:     function _enableRule($rule)
15:     {
16:         $filters = $GLOBALS['ingo_storage']->retrieve(Ingo_Storage::ACTION_FILTERS);
17:         foreach ($filters->getFilterList() as $k => $v) {
18:             if ($v['action'] == $rule) {
19:                 $v['disable'] = false;
20:                 $filters->updateRule($v, $k);
21:                 $this->store($filters);
22:             }
23:         }
24:     }
25: 
26:     function assertScript($expect)
27:     {
28:         $result = $GLOBALS['ingo_script']->generate();
29:         if (!is_string($result)) {
30:             $this->fail("result not a script", 1);
31:             return;
32:         }
33: 
34:         /* Remove comments and crunch whitespace so we can have a functional
35:          * comparison. */
36:         $new = array();
37:         foreach (explode("\n", $result) as $line) {
38:             if (preg_match('/^\s*$/', $line)) {
39:                 continue;
40:             }
41:             if (preg_match('/^\s*#.*$/', $line)) {
42:                 continue;
43:             }
44:             $new[] = trim($line);
45:         }
46: 
47:         $new_script = join("\n", $new);
48:         $this->assertEquals($expect, $new_script);
49:     }
50: 
51: }
52: 
53: class Ingo_Test_Notification {
54: 
55:     function push()
56:     {
57:     }
58: 
59: }
API documentation generated by ApiGen