function testExpireAtDate() { $doc = new DMSDocument(); $doc->Filename = "DMS-test-lorum-file.pdf"; $doc->Folder = "tests"; $doc->write(); $doc->expireAtDate(strtotime('-1 second')); $this->assertTrue($doc->isHidden(), "Document is hidden"); $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); $this->assertTrue($doc->isExpired(), "Document is expired"); $expireTime = "2019-04-05 11:43:13"; $doc->expireAtDate($expireTime); $this->assertFalse($doc->isHidden(), "Document is not hidden"); $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); $this->assertFalse($doc->isExpired(), "Document is not expired"); SS_Datetime::set_mock_now($expireTime); $this->assertTrue($doc->isHidden(), "Document is hidden"); $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); $this->assertTrue($doc->isExpired(), "Document is expired"); SS_Datetime::clear_mock_now(); $doc->expireAtDate(strtotime('-1 second')); $this->assertTrue($doc->isHidden(), "Document is hidden"); $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); $this->assertTrue($doc->isExpired(), "Document is expired"); $doc->clearExpiry(); $this->assertFalse($doc->isHidden(), "Document is not hidden"); $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); $this->assertFalse($doc->isExpired(), "Document is not expired"); }