Skip to content
Snippets Groups Projects
Commit 232a5e8d authored by Jigal van Hemert's avatar Jigal van Hemert Committed by Christian Kuhn
Browse files

[TASK] Add unit tests for stdWrap_strftime

Change-Id: Ic4a640c880a59bf322101efb1ab7fb58bb8ace48
Fixes: #40876
Releases: 6.0
Reviewed-on: http://review.typo3.org/14560
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
parent 22ff3b64
No related merge requests found
......@@ -1029,6 +1029,56 @@ class ContentObjectRendererTest extends \tx_phpunit_testcase {
}
}
/**
* Data provider for the stdWrap_strftime test
*
* @return array multi-dimensional array with the second level like this:
* @see stdWrap_strftime
*/
public function stdWrap_strftimeReturnsFormattedStringDataProvider() {
$data = array(
'given timestamp' => array(
1346500800, // This is 2012-09-01 12:00 in UTC/GMT
array(
'strftime' => '%d-%m-%Y',
),
),
'empty string' => array(
'',
array(
'strftime' => '%d-%m-%Y',
),
),
'testing null' => array(
NULL,
array(
'strftime' => '%d-%m-%Y',
),
),
);
return $data;
}
/**
* @test
* @dataProvider stdWrap_strftimeReturnsFormattedStringDataProvider
*/
public function stdWrap_strftimeReturnsFormattedString($content, $conf) {
// Set exec_time to a hard timestamp (backed up by $this->backupGlobals = TRUE)
$GLOBALS['EXEC_TIME'] = 1346500800;
// Save current timezone and set to UTC to make the system unter test behave
// the same in all server timezone settings
$timezoneBackup = date_default_timezone_get();
date_default_timezone_set('UTC');
$result = $this->cObj->stdWrap_strftime($content, $conf);
// Reset timezone
date_default_timezone_set($timezoneBackup);
$this->assertEquals('01-09-2012', $result);
}
}
?>
\ No newline at end of file
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment