mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 21:22:40 +00:00
Ensure tests do not rely in UTC default timezone
Six tests failed if the default timezone was not UTC. These were all due to faulty expectations, however, not faulty output.
This commit is contained in:
parent
092b793e0a
commit
3f65625090
4 changed files with 33 additions and 32 deletions
|
@ -456,7 +456,7 @@ class TestValueInfo extends Test\AbstractTest {
|
|||
["Fri, 01 Jan 2010 00:00:00 GMT", null, null, null, $this->t(1262304000), null, null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01 00:00:00", null, null, null, null, $this->t(1262304000), null, null, null, null, null, $this->t(1262304000), ],
|
||||
["2010-01-01", null, null, null, null, null, $this->t(1262304000), null, null, null, null, $this->t(1262304000), ],
|
||||
["12:34:56", null, null, null, null, null, null, $this->t(45296), null, null, null, $this->t(strtotime("today")+45296), ],
|
||||
["12:34:56", null, null, null, null, null, null, $this->t(45296), null, null, null, $this->t(strtotime("Today UTC")+45296), ],
|
||||
["1262304000", null, null, null, null, null, null, null, $this->t(1262304000), null, null, null, ],
|
||||
["1262304000.123456", null, null, null, null, null, null, null, null, $this->t(1262304000.123456), null, null, ],
|
||||
["1262304000.42", null, null, null, null, null, null, null, null, $this->t(1262304000.42), null, null, ],
|
||||
|
|
|
@ -1346,7 +1346,7 @@ LONG_STRING;
|
|||
'published' => false,
|
||||
'comments' => "",
|
||||
'author' => '',
|
||||
'updated' => strtotime('2000-01-01 00:00:01'),
|
||||
'updated' => strtotime('2000-01-01T00:00:01Z'),
|
||||
'feed_id' => "8",
|
||||
'feed_title' => "Feed 11",
|
||||
'attachments' => [],
|
||||
|
@ -1369,7 +1369,7 @@ LONG_STRING;
|
|||
'published' => false,
|
||||
'comments' => "",
|
||||
'author' => "J. King",
|
||||
'updated' => strtotime('2000-01-02 00:00:02'),
|
||||
'updated' => strtotime('2000-01-02T00:00:02Z'),
|
||||
'feed_id' => "8",
|
||||
'feed_title' => "Feed 11",
|
||||
'attachments' => [
|
||||
|
@ -1771,7 +1771,7 @@ LONG_STRING;
|
|||
'marked' => false,
|
||||
'published' => false,
|
||||
'author' => '',
|
||||
'updated' => strtotime('2000-01-01 00:00:00'),
|
||||
'updated' => strtotime('2000-01-01T00:00:00Z'),
|
||||
'is_updated' => false,
|
||||
'feed_id' => "12",
|
||||
'feed_title' => "Feed 2112",
|
||||
|
@ -1796,7 +1796,7 @@ LONG_STRING;
|
|||
'marked' => true,
|
||||
'published' => false,
|
||||
'author' => "J. King",
|
||||
'updated' => strtotime('2000-01-02 00:00:02'),
|
||||
'updated' => strtotime('2000-01-02T00:00:02Z'),
|
||||
'is_updated' => true,
|
||||
'feed_id' => "8",
|
||||
'feed_title' => "Feed 11",
|
||||
|
|
|
@ -51,6 +51,7 @@ abstract class AbstractTest extends \PHPUnit\Framework\TestCase {
|
|||
}
|
||||
|
||||
public function clearData(bool $loadLang = true): bool {
|
||||
date_default_timezone_set("America/Toronto");
|
||||
$r = new \ReflectionClass(\JKingWeb\Arsse\Arsse::class);
|
||||
$props = array_keys($r->getStaticProperties());
|
||||
foreach ($props as $prop) {
|
||||
|
|
|
@ -195,7 +195,7 @@ trait BindingTests {
|
|||
|
||||
public function testBindIso8601DateString() {
|
||||
$input = "2017-01-09T13:11:17";
|
||||
$time = strtotime($input);
|
||||
$time = strtotime($input." UTC");
|
||||
$exp = [
|
||||
"null" => null,
|
||||
"integer" => 2017,
|
||||
|
@ -213,7 +213,7 @@ trait BindingTests {
|
|||
|
||||
public function testBindArbitraryDateString() {
|
||||
$input = "Today";
|
||||
$time = strtotime($input);
|
||||
$time = strtotime($input." UTC");
|
||||
$exp = [
|
||||
"null" => null,
|
||||
"integer" => 0,
|
||||
|
|
Loading…
Reference in a new issue