-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18396 from owncloud/autoloader-check-path
verify the path in the autoloader
- Loading branch information
Showing
5 changed files
with
86 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
<?php | ||
/** | ||
* ownCloud | ||
* | ||
* @author Bernhard Posselt | ||
* @copyright 2012 Bernhard Posselt <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
/** | ||
* ownCloud | ||
* | ||
* @author Bernhard Posselt | ||
* @copyright 2012 Bernhard Posselt <[email protected]> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
class Test_TemplateFunctions extends \Test\TestCase { | ||
|
||
protected function setUp() { | ||
parent::setUp(); | ||
|
||
$loader = new \OC\Autoloader(); | ||
$loader = new \OC\Autoloader([OC::$SERVERROOT . '/lib']); | ||
$loader->load('OC_Template'); | ||
} | ||
|
||
|
@@ -60,7 +60,7 @@ public function testPrintUnescapedNormalString() { | |
// --------------------------------------------------------------------------- | ||
// Test relative_modified_date with dates only | ||
// --------------------------------------------------------------------------- | ||
public function testRelativeDateToday(){ | ||
public function testRelativeDateToday() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -74,7 +74,7 @@ public function testRelativeDateToday(){ | |
$this->assertEquals('today', $result); | ||
} | ||
|
||
public function testRelativeDateYesterday(){ | ||
public function testRelativeDateYesterday() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 24 * 3600; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -88,7 +88,7 @@ public function testRelativeDateYesterday(){ | |
$this->assertEquals('yesterday', $result); | ||
} | ||
|
||
public function testRelativeDate2DaysAgo(){ | ||
public function testRelativeDate2DaysAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 48 * 3600; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -102,7 +102,7 @@ public function testRelativeDate2DaysAgo(){ | |
$this->assertEquals('2 days ago', $result); | ||
} | ||
|
||
public function testRelativeDateLastMonth(){ | ||
public function testRelativeDateLastMonth() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 31; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -115,7 +115,7 @@ public function testRelativeDateLastMonth(){ | |
$this->assertEquals('last month', $result); | ||
} | ||
|
||
public function testRelativeDateMonthsAgo(){ | ||
public function testRelativeDateMonthsAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 65; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -128,7 +128,7 @@ public function testRelativeDateMonthsAgo(){ | |
$this->assertEquals('4 months ago', $result); | ||
} | ||
|
||
public function testRelativeDateLastYear(){ | ||
public function testRelativeDateLastYear() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 365; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -141,7 +141,7 @@ public function testRelativeDateLastYear(){ | |
$this->assertEquals('last year', $result); | ||
} | ||
|
||
public function testRelativeDateYearsAgo(){ | ||
public function testRelativeDateYearsAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 365.25 * 2; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, true); | ||
|
@@ -158,31 +158,31 @@ public function testRelativeDateYearsAgo(){ | |
// Test relative_modified_date with timestamps only (date + time value) | ||
// --------------------------------------------------------------------------- | ||
|
||
public function testRelativeTimeSecondsAgo(){ | ||
public function testRelativeTimeSecondsAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 5; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
||
$this->assertEquals('seconds ago', $result); | ||
} | ||
|
||
public function testRelativeTimeMinutesAgo(){ | ||
public function testRelativeTimeMinutesAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 190; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
||
$this->assertEquals('3 minutes ago', $result); | ||
} | ||
|
||
public function testRelativeTimeHoursAgo(){ | ||
public function testRelativeTimeHoursAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 7500; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
||
$this->assertEquals('2 hours ago', $result); | ||
} | ||
|
||
public function testRelativeTime2DaysAgo(){ | ||
public function testRelativeTime2DaysAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 48 * 3600; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
@@ -196,7 +196,7 @@ public function testRelativeTime2DaysAgo(){ | |
$this->assertEquals('2 days ago', $result); | ||
} | ||
|
||
public function testRelativeTimeLastMonth(){ | ||
public function testRelativeTimeLastMonth() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 31; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
@@ -209,7 +209,7 @@ public function testRelativeTimeLastMonth(){ | |
$this->assertEquals('last month', $result); | ||
} | ||
|
||
public function testRelativeTimeMonthsAgo(){ | ||
public function testRelativeTimeMonthsAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 65; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
@@ -222,7 +222,7 @@ public function testRelativeTimeMonthsAgo(){ | |
$this->assertEquals('4 months ago', $result); | ||
} | ||
|
||
public function testRelativeTimeLastYear(){ | ||
public function testRelativeTimeLastYear() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 365; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|
@@ -235,7 +235,7 @@ public function testRelativeTimeLastYear(){ | |
$this->assertEquals('last year', $result); | ||
} | ||
|
||
public function testRelativeTimeYearsAgo(){ | ||
public function testRelativeTimeYearsAgo() { | ||
$currentTime = 1380703592; | ||
$elementTime = $currentTime - 86400 * 365.25 * 2; | ||
$result = (string)relative_modified_date($elementTime, $currentTime, false); | ||
|