public function testTimestampToDate_suchMagic() { $dt = new DateTime('August 10, 2020 3:00p'); $timestamp = $dt->getTimestamp() - ClockProvider::$EPOCH; $dtft = ClockProvider::timestampToDate($timestamp); $this->assertEquals($dt, $dtft); }
public function testUnsign_expiredSignature_ShouldComplain() { $this->setExpectedException('ItsDangerous\\BadData\\SignatureExpired'); $nowString = '2016-01-10 08:13:31'; ClockProvider::setTestNow(new DateTime($nowString)); $ts = new TimestampSigner("another_secret"); $ts->unsign('haldo.CXOj7w.soK7_HnTROV4Lew0zlxDV0mUE8I', 30); }
public function testLoad_expiredFromFile_shouldComplain() { $fp = fopen('php://temp', 'r+'); fwrite($fp, $this->signedJSON); rewind($fp); $this->setExpectedException('ItsDangerous\\BadData\\SignatureExpired'); $nowString = '2016-01-10 08:13:31'; ClockProvider::setTestNow(new DateTime($nowString)); $ser = new TimedSerializer("asecret"); $wasRead = $ser->load($fp, 30); }
public function timestamp_to_datetime($ts) { return ClockProvider::timestampToDate($ts); }