11<?php
2- /**
3- * ownCloud
4- *
5- * @author Bernhard Posselt
6- * @copyright 2012 Bernhard Posselt <dev@bernhard-posselt.com>
7- *
8- * This library is free software; you can redistribute it and/or
9- * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
10- * License as published by the Free Software Foundation; either
11- * version 3 of the License, or any later version.
12- *
13- * This library is distributed in the hope that it will be useful,
14- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16- * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
17- *
18- * You should have received a copy of the GNU Affero General Public
19- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
20- *
21- */
222
3+ /**
4+ * ownCloud
5+ *
6+ * @author Bernhard Posselt
7+ * @copyright 2012 Bernhard Posselt <dev@bernhard-posselt.com>
8+ *
9+ * This library is free software; you can redistribute it and/or
10+ * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE
11+ * License as published by the Free Software Foundation; either
12+ * version 3 of the License, or any later version.
13+ *
14+ * This library is distributed in the hope that it will be useful,
15+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
16+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+ * GNU AFFERO GENERAL PUBLIC LICENSE for more details.
18+ *
19+ * You should have received a copy of the GNU Affero General Public
20+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
21+ *
22+ */
2323class Test_TemplateFunctions extends \Test \TestCase {
2424
2525 protected function setUp () {
2626 parent ::setUp ();
2727
28- $ loader = new \OC \Autoloader ();
28+ $ loader = new \OC \Autoloader ([ OC :: $ SERVERROOT . ' /lib ' ] );
2929 $ loader ->load ('OC_Template ' );
3030 }
3131
@@ -60,7 +60,7 @@ public function testPrintUnescapedNormalString() {
6060 // ---------------------------------------------------------------------------
6161 // Test relative_modified_date with dates only
6262 // ---------------------------------------------------------------------------
63- public function testRelativeDateToday (){
63+ public function testRelativeDateToday () {
6464 $ currentTime = 1380703592 ;
6565 $ elementTime = $ currentTime ;
6666 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -74,7 +74,7 @@ public function testRelativeDateToday(){
7474 $ this ->assertEquals ('today ' , $ result );
7575 }
7676
77- public function testRelativeDateYesterday (){
77+ public function testRelativeDateYesterday () {
7878 $ currentTime = 1380703592 ;
7979 $ elementTime = $ currentTime - 24 * 3600 ;
8080 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -88,7 +88,7 @@ public function testRelativeDateYesterday(){
8888 $ this ->assertEquals ('yesterday ' , $ result );
8989 }
9090
91- public function testRelativeDate2DaysAgo (){
91+ public function testRelativeDate2DaysAgo () {
9292 $ currentTime = 1380703592 ;
9393 $ elementTime = $ currentTime - 48 * 3600 ;
9494 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -102,7 +102,7 @@ public function testRelativeDate2DaysAgo(){
102102 $ this ->assertEquals ('2 days ago ' , $ result );
103103 }
104104
105- public function testRelativeDateLastMonth (){
105+ public function testRelativeDateLastMonth () {
106106 $ currentTime = 1380703592 ;
107107 $ elementTime = $ currentTime - 86400 * 31 ;
108108 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -115,7 +115,7 @@ public function testRelativeDateLastMonth(){
115115 $ this ->assertEquals ('last month ' , $ result );
116116 }
117117
118- public function testRelativeDateMonthsAgo (){
118+ public function testRelativeDateMonthsAgo () {
119119 $ currentTime = 1380703592 ;
120120 $ elementTime = $ currentTime - 86400 * 65 ;
121121 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -128,7 +128,7 @@ public function testRelativeDateMonthsAgo(){
128128 $ this ->assertEquals ('4 months ago ' , $ result );
129129 }
130130
131- public function testRelativeDateLastYear (){
131+ public function testRelativeDateLastYear () {
132132 $ currentTime = 1380703592 ;
133133 $ elementTime = $ currentTime - 86400 * 365 ;
134134 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -141,7 +141,7 @@ public function testRelativeDateLastYear(){
141141 $ this ->assertEquals ('last year ' , $ result );
142142 }
143143
144- public function testRelativeDateYearsAgo (){
144+ public function testRelativeDateYearsAgo () {
145145 $ currentTime = 1380703592 ;
146146 $ elementTime = $ currentTime - 86400 * 365.25 * 2 ;
147147 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , true );
@@ -158,31 +158,31 @@ public function testRelativeDateYearsAgo(){
158158 // Test relative_modified_date with timestamps only (date + time value)
159159 // ---------------------------------------------------------------------------
160160
161- public function testRelativeTimeSecondsAgo (){
161+ public function testRelativeTimeSecondsAgo () {
162162 $ currentTime = 1380703592 ;
163163 $ elementTime = $ currentTime - 5 ;
164164 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
165165
166166 $ this ->assertEquals ('seconds ago ' , $ result );
167167 }
168168
169- public function testRelativeTimeMinutesAgo (){
169+ public function testRelativeTimeMinutesAgo () {
170170 $ currentTime = 1380703592 ;
171171 $ elementTime = $ currentTime - 190 ;
172172 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
173173
174174 $ this ->assertEquals ('3 minutes ago ' , $ result );
175175 }
176176
177- public function testRelativeTimeHoursAgo (){
177+ public function testRelativeTimeHoursAgo () {
178178 $ currentTime = 1380703592 ;
179179 $ elementTime = $ currentTime - 7500 ;
180180 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
181181
182182 $ this ->assertEquals ('2 hours ago ' , $ result );
183183 }
184184
185- public function testRelativeTime2DaysAgo (){
185+ public function testRelativeTime2DaysAgo () {
186186 $ currentTime = 1380703592 ;
187187 $ elementTime = $ currentTime - 48 * 3600 ;
188188 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
@@ -196,7 +196,7 @@ public function testRelativeTime2DaysAgo(){
196196 $ this ->assertEquals ('2 days ago ' , $ result );
197197 }
198198
199- public function testRelativeTimeLastMonth (){
199+ public function testRelativeTimeLastMonth () {
200200 $ currentTime = 1380703592 ;
201201 $ elementTime = $ currentTime - 86400 * 31 ;
202202 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
@@ -209,7 +209,7 @@ public function testRelativeTimeLastMonth(){
209209 $ this ->assertEquals ('last month ' , $ result );
210210 }
211211
212- public function testRelativeTimeMonthsAgo (){
212+ public function testRelativeTimeMonthsAgo () {
213213 $ currentTime = 1380703592 ;
214214 $ elementTime = $ currentTime - 86400 * 65 ;
215215 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
@@ -222,7 +222,7 @@ public function testRelativeTimeMonthsAgo(){
222222 $ this ->assertEquals ('4 months ago ' , $ result );
223223 }
224224
225- public function testRelativeTimeLastYear (){
225+ public function testRelativeTimeLastYear () {
226226 $ currentTime = 1380703592 ;
227227 $ elementTime = $ currentTime - 86400 * 365 ;
228228 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
@@ -235,7 +235,7 @@ public function testRelativeTimeLastYear(){
235235 $ this ->assertEquals ('last year ' , $ result );
236236 }
237237
238- public function testRelativeTimeYearsAgo (){
238+ public function testRelativeTimeYearsAgo () {
239239 $ currentTime = 1380703592 ;
240240 $ elementTime = $ currentTime - 86400 * 365.25 * 2 ;
241241 $ result = (string )relative_modified_date ($ elementTime , $ currentTime , false );
0 commit comments