[17073] | 1 | <?php |
---|
| 2 | // $Id: decorator_textual_test.php,v 1.1 2004/05/24 22:25:43 quipo Exp $ |
---|
| 3 | |
---|
| 4 | require_once('simple_include.php'); |
---|
| 5 | require_once('calendar_include.php'); |
---|
| 6 | |
---|
| 7 | require_once('./decorator_test.php'); |
---|
| 8 | |
---|
| 9 | class TestOfDecoratorTextual extends TestOfDecorator { |
---|
| 10 | function TestOfDecoratorTextual() { |
---|
| 11 | $this->UnitTestCase('Test of Calendar_Decorator_Textual'); |
---|
| 12 | } |
---|
| 13 | function testMonthNamesLong() { |
---|
| 14 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 15 | $monthNames = array( |
---|
| 16 | 1=>'January', |
---|
| 17 | 2=>'February', |
---|
| 18 | 3=>'March', |
---|
| 19 | 4=>'April', |
---|
| 20 | 5=>'May', |
---|
| 21 | 6=>'June', |
---|
| 22 | 7=>'July', |
---|
| 23 | 8=>'August', |
---|
| 24 | 9=>'September', |
---|
| 25 | 10=>'October', |
---|
| 26 | 11=>'November', |
---|
| 27 | 12=>'December', |
---|
| 28 | ); |
---|
| 29 | $this->assertEqual($monthNames,$Textual->monthNames()); |
---|
| 30 | } |
---|
| 31 | function testMonthNamesShort() { |
---|
| 32 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 33 | $monthNames = array( |
---|
| 34 | 1=>'Jan', |
---|
| 35 | 2=>'Feb', |
---|
| 36 | 3=>'Mar', |
---|
| 37 | 4=>'Apr', |
---|
| 38 | 5=>'May', |
---|
| 39 | 6=>'Jun', |
---|
| 40 | 7=>'Jul', |
---|
| 41 | 8=>'Aug', |
---|
| 42 | 9=>'Sep', |
---|
| 43 | 10=>'Oct', |
---|
| 44 | 11=>'Nov', |
---|
| 45 | 12=>'Dec', |
---|
| 46 | ); |
---|
| 47 | $this->assertEqual($monthNames,$Textual->monthNames('short')); |
---|
| 48 | } |
---|
| 49 | function testMonthNamesTwo() { |
---|
| 50 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 51 | $monthNames = array( |
---|
| 52 | 1=>'Ja', |
---|
| 53 | 2=>'Fe', |
---|
| 54 | 3=>'Ma', |
---|
| 55 | 4=>'Ap', |
---|
| 56 | 5=>'Ma', |
---|
| 57 | 6=>'Ju', |
---|
| 58 | 7=>'Ju', |
---|
| 59 | 8=>'Au', |
---|
| 60 | 9=>'Se', |
---|
| 61 | 10=>'Oc', |
---|
| 62 | 11=>'No', |
---|
| 63 | 12=>'De', |
---|
| 64 | ); |
---|
| 65 | $this->assertEqual($monthNames,$Textual->monthNames('two')); |
---|
| 66 | } |
---|
| 67 | function testMonthNamesOne() { |
---|
| 68 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 69 | $monthNames = array( |
---|
| 70 | 1=>'J', |
---|
| 71 | 2=>'F', |
---|
| 72 | 3=>'M', |
---|
| 73 | 4=>'A', |
---|
| 74 | 5=>'M', |
---|
| 75 | 6=>'J', |
---|
| 76 | 7=>'J', |
---|
| 77 | 8=>'A', |
---|
| 78 | 9=>'S', |
---|
| 79 | 10=>'O', |
---|
| 80 | 11=>'N', |
---|
| 81 | 12=>'D', |
---|
| 82 | ); |
---|
| 83 | $this->assertEqual($monthNames,$Textual->monthNames('one')); |
---|
| 84 | } |
---|
| 85 | function testWeekdayNamesLong() { |
---|
| 86 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 87 | $weekdayNames = array( |
---|
| 88 | 0=>'Sunday', |
---|
| 89 | 1=>'Monday', |
---|
| 90 | 2=>'Tuesday', |
---|
| 91 | 3=>'Wednesday', |
---|
| 92 | 4=>'Thursday', |
---|
| 93 | 5=>'Friday', |
---|
| 94 | 6=>'Saturday', |
---|
| 95 | ); |
---|
| 96 | $this->assertEqual($weekdayNames,$Textual->weekdayNames()); |
---|
| 97 | } |
---|
| 98 | function testWeekdayNamesShort() { |
---|
| 99 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 100 | $weekdayNames = array( |
---|
| 101 | 0=>'Sun', |
---|
| 102 | 1=>'Mon', |
---|
| 103 | 2=>'Tue', |
---|
| 104 | 3=>'Wed', |
---|
| 105 | 4=>'Thu', |
---|
| 106 | 5=>'Fri', |
---|
| 107 | 6=>'Sat', |
---|
| 108 | ); |
---|
| 109 | $this->assertEqual($weekdayNames,$Textual->weekdayNames('short')); |
---|
| 110 | } |
---|
| 111 | function testWeekdayNamesTwo() { |
---|
| 112 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 113 | $weekdayNames = array( |
---|
| 114 | 0=>'Su', |
---|
| 115 | 1=>'Mo', |
---|
| 116 | 2=>'Tu', |
---|
| 117 | 3=>'We', |
---|
| 118 | 4=>'Th', |
---|
| 119 | 5=>'Fr', |
---|
| 120 | 6=>'Sa', |
---|
| 121 | ); |
---|
| 122 | $this->assertEqual($weekdayNames,$Textual->weekdayNames('two')); |
---|
| 123 | } |
---|
| 124 | function testWeekdayNamesOne() { |
---|
| 125 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 126 | $weekdayNames = array( |
---|
| 127 | 0=>'S', |
---|
| 128 | 1=>'M', |
---|
| 129 | 2=>'T', |
---|
| 130 | 3=>'W', |
---|
| 131 | 4=>'T', |
---|
| 132 | 5=>'F', |
---|
| 133 | 6=>'S', |
---|
| 134 | ); |
---|
| 135 | $this->assertEqual($weekdayNames,$Textual->weekdayNames('one')); |
---|
| 136 | } |
---|
| 137 | function testPrevMonthNameShort() { |
---|
| 138 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 139 | $this->assertEqual('Sep',$Textual->prevMonthName('short')); |
---|
| 140 | } |
---|
| 141 | function testThisMonthNameShort() { |
---|
| 142 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 143 | $this->assertEqual('Oct',$Textual->thisMonthName('short')); |
---|
| 144 | } |
---|
| 145 | function testNextMonthNameShort() { |
---|
| 146 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 147 | $this->assertEqual('Nov',$Textual->nextMonthName('short')); |
---|
| 148 | } |
---|
| 149 | function testThisDayNameShort() { |
---|
| 150 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 151 | $this->assertEqual('Wed',$Textual->thisDayName('short')); |
---|
| 152 | } |
---|
| 153 | function testOrderedWeekdaysShort() { |
---|
| 154 | $weekdayNames = array( |
---|
| 155 | 0=>'Sun', |
---|
| 156 | 1=>'Mon', |
---|
| 157 | 2=>'Tue', |
---|
| 158 | 3=>'Wed', |
---|
| 159 | 4=>'Thu', |
---|
| 160 | 5=>'Fri', |
---|
| 161 | 6=>'Sat', |
---|
| 162 | ); |
---|
| 163 | $Textual = new Calendar_Decorator_Textual($this->mockcal); |
---|
| 164 | $this->assertEqual($weekdayNames,$Textual->orderedWeekdays('short')); |
---|
| 165 | } |
---|
| 166 | |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | if (!defined('TEST_RUNNING')) { |
---|
| 170 | define('TEST_RUNNING', true); |
---|
| 171 | $test = &new TestOfDecoratorTextual(); |
---|
| 172 | $test->run(new HtmlReporter()); |
---|
| 173 | } |
---|
| 174 | ?> |
---|