Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

soap/VersionTest.php: take timezone into consideration

Prior to this, dates were compared as string, resulting in
'2015-10-29T12:59:14+00:00' and '2015-10-29T05:59:14-07:00' to be
considered as different dates.

Fixes #15817
  • Loading branch information...
commit 4465b2f1eefff0e34ed08cf9ad05867a19f70e95 1 parent a9ac81a
@dregad dregad authored dregad committed
Showing with 16 additions and 2 deletions.
  1. +16 −2 tests/soap/VersionTest.php
View
18 tests/soap/VersionTest.php
@@ -43,6 +43,17 @@ private function getTestVersion() {
}
/**
+ * Converts date to UTC
+ * @param $p_date date string
+ * @return DateTime object
+ * Tests creating a new version
+ */
+ private function dateToUTC($p_date) {
+ $convDate = new DateTime($p_date);
+ return $convDate->setTimeZone(new DateTimeZone('UTC'));
+ }
+
+ /**
* Tests creating a new version
*/
public function testAddVersion() {
@@ -60,12 +71,13 @@ public function testAddVersion() {
$this->assertEquals(1, count($versions) - $initialVersions);
$version = $versions[0];
+ $versDate = $this->dateToUTC($version->date_order);
$this->assertEquals('1.0', $version->name);
$this->assertEquals(true, $version->released);
$this->assertEquals('Test version', $version->description);
$this->assertEquals($this->getProjectId(), $version->project_id);
- $this->assertEquals(self::DATE_ORDER, $version->date_order);
+ $this->assertEquals($this->dateToUTC(self::DATE_ORDER), $versDate);
$this->assertEquals(false, $version->obsolete);
}
@@ -94,8 +106,10 @@ public function testUpdateVersion() {
foreach ( $versions as $version ) {
if ( $version->id == $versionId ) {
+ $versDate = $this->dateToUTC($version->date_order);
+
$this->assertEquals('1.1', $version->name);
- $this->assertEquals(self::DATE_ORDER, $version->date_order);
+ $this->assertEquals($this->dateToUTC(self::DATE_ORDER), $versDate);
return;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.