public function testSetTimestamp()
 {
     $date = new DateTimeImmutable('@' . time());
     $newDate = $date->setTimestamp(strtotime('-4 days'));
     $this->assertNotSame($date, $newDate);
     $this->assertNotEquals($date->getTimestamp(), $newDate->getTimestamp());
     $this->assertInstanceOf('Message\\Cog\\ValueObject\\DateTimeImmutable', $newDate);
 }
 /**
  * Update the page to be unpublished
  *
  * @param  Page   	$page Page to update as unpublished
  *
  * @return Page   	$page Updated Page object
  */
 public function unpublish(Page $page)
 {
     // Set the end time to now
     $end = new DateTimeImmutable();
     $start = $page->publishDateRange->getStart();
     // If the start date is in the new end time then set it to null
     if ($start && $start->getTimestamp() > $end->getTimestamp()) {
         $start = null;
     }
     // Set the new unpublsih date range
     $page->publishDateRange = new DateRange($start, $end);
     // Save the page to the DB
     $this->_savePublishData($page);
     // Return the updated Page object
     $this->_transaction->commit();
     return $page;
 }