Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixing docblock and removing tests for code that was deleted
  • Loading branch information
lorenzo committed Apr 21, 2014
1 parent 64abd3f commit f3f072a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 82 deletions.
2 changes: 1 addition & 1 deletion src/Utility/Time.php
Expand Up @@ -182,7 +182,7 @@ public function toUnixString() {

/**
* Returns either a relative or a formatted absolute date depending
* on the difference between the current time this object.
* on the difference between the current time and this object.
*
* ### Options:
*
Expand Down
81 changes: 0 additions & 81 deletions tests/TestCase/Utility/TimeTest.php
Expand Up @@ -381,37 +381,6 @@ public function testToUnix() {
$this->assertEquals('1639206001', $time->toUnixString());
}

/**
* testToAtom method
*
* @return void
*/
public function testToAtom() {
$dateTime = new \DateTime;
$this->assertEquals($dateTime->format($dateTime::ATOM), $this->Time->toAtom($dateTime->getTimestamp()));
}

/**
* testToRss method
*
* @return void
*/
public function testToRss() {
$date = '2012-08-12 12:12:45';
$time = strtotime($date);
$this->assertEquals(date('r', $time), $this->Time->toRss($time));

$timezones = array('Europe/London', 'Europe/Brussels', 'UTC', 'America/Denver', 'America/Caracas', 'Asia/Kathmandu');
foreach ($timezones as $timezone) {
$yourTimezone = new \DateTimeZone($timezone);
$yourTime = new \DateTime($date, $yourTimezone);
$userOffset = $yourTimezone->getOffset($yourTime) / HOUR;
$time = $yourTime->format('U');
$this->assertEquals($yourTime->format('r'), $this->Time->toRss($time, $userOffset), "Failed on $timezone");
$this->assertEquals($yourTime->format('r'), $this->Time->toRss($time, $timezone), "Failed on $timezone");
}
}

/**
* testFormat method
*
Expand Down Expand Up @@ -439,56 +408,6 @@ public function testFormat() {
$this->assertEquals('invalid', $result);
}

/**
* testIsToday method
*
* @return void
*/
public function testIsToday() {
$result = $this->Time->isToday('+1 day');
$this->assertFalse($result);
$result = $this->Time->isToday('+1 days');
$this->assertFalse($result);
$result = $this->Time->isToday('+0 day');
$this->assertTrue($result);
$result = $this->Time->isToday('-1 day');
$this->assertFalse($result);
}

/**
* testIsFuture method
*
* @return void
*/
public function testIsFuture() {
$this->assertTrue($this->Time->isFuture('+1 month'));
$this->assertTrue($this->Time->isFuture('+1 days'));
$this->assertTrue($this->Time->isFuture('+1 minute'));
$this->assertTrue($this->Time->isFuture('+1 second'));

$this->assertFalse($this->Time->isFuture('-1 second'));
$this->assertFalse($this->Time->isFuture('-1 day'));
$this->assertFalse($this->Time->isFuture('-1 week'));
$this->assertFalse($this->Time->isFuture('-1 month'));
}

/**
* testIsPast method
*
* @return void
*/
public function testIsPast() {
$this->assertFalse($this->Time->isPast('+1 month'));
$this->assertFalse($this->Time->isPast('+1 days'));
$this->assertFalse($this->Time->isPast('+1 minute'));
$this->assertFalse($this->Time->isPast('+1 second'));

$this->assertTrue($this->Time->isPast('-1 second'));
$this->assertTrue($this->Time->isPast('-1 day'));
$this->assertTrue($this->Time->isPast('-1 week'));
$this->assertTrue($this->Time->isPast('-1 month'));
}

/**
* testIsThisWeek method
*
Expand Down

0 comments on commit f3f072a

Please sign in to comment.