Subversion Repositories Applications.papyrus

Rev

Rev 1372 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
493 ddelon 1
<?php
2
// $Id: util_uri_test.php,v 1.1 2005-09-30 14:58:00 ddelon Exp $
3
 
4
require_once('simple_include.php');
5
require_once('calendar_include.php');
6
 
7
Mock::generate('Calendar_Day','Mock_Calendar_Day');
8
Mock::generate('Calendar_Engine_Interface','Mock_Calendar_Engine');
9
 
10
class TestOfUtilUri extends UnitTestCase {
11
 
12
    var $MockCal;
13
 
14
    function TestOfUtilUri() {
15
        $this->UnitTestCase('Test of Calendar_Util_Uri');
16
    }
17
 
18
    function setUp() {
19
        $this->MockCal = & new Mock_Calendar_Day($this);
20
        $this->MockCal->setReturnValue('getEngine',new Mock_Calendar_Engine($this));
21
    }
22
 
23
    function testFragments() {
24
        $Uri = new Calendar_Util_Uri('y','m','d','h','m','s');
25
        $Uri->setFragments('year','month','day','hour','minute','second');
26
        $this->assertEqual(
27
            'year=&amp;month=&amp;day=&amp;hour=&amp;minute=&amp;second=',
28
            $Uri->this($this->MockCal, 'second')
29
        );
30
    }
31
    function testScalarFragments() {
32
        $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second');
33
        $Uri->scalar = true;
34
        $this->assertEqual(
35
            '&amp;&amp;&amp;&amp;&amp;',
36
            $Uri->this($this->MockCal, 'second')
37
        );
38
    }
39
    function testSetSeperator() {
40
        $Uri = new Calendar_Util_Uri('year','month','day','hour','minute','second');
41
        $Uri->separator = '/';
42
        $this->assertEqual(
43
            'year=/month=/day=/hour=/minute=/second=',
44
            $Uri->this($this->MockCal, 'second')
45
        );
46
    }
47
}
48
 
49
if (!defined('TEST_RUNNING')) {
50
    define('TEST_RUNNING', true);
51
    $test = &new TestOfUtilUri();
52
    $test->run(new HtmlReporter());
53
}
54
?>