@@ 64-97 (lines=34) @@ | ||
61 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
62 | } |
|
63 | ||
64 | public function testExpireAtDate() |
|
65 | { |
|
66 | $doc = new DMSDocument(); |
|
67 | $doc->Filename = "DMS-test-lorum-file.pdf"; |
|
68 | $doc->Folder = "tests"; |
|
69 | $doc->write(); |
|
70 | ||
71 | $doc->expireAtDate(strtotime('-1 second')); |
|
72 | $this->assertTrue($doc->isHidden(), "Document is hidden"); |
|
73 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
74 | $this->assertTrue($doc->isExpired(), "Document is expired"); |
|
75 | ||
76 | $expireTime = "2069-12-12 17:10:13"; |
|
77 | $doc->expireAtDate($expireTime); |
|
78 | $this->assertFalse($doc->isHidden(), "Document is not hidden"); |
|
79 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
80 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
81 | ||
82 | SS_Datetime::set_mock_now($expireTime); |
|
83 | $this->assertTrue($doc->isHidden(), "Document is hidden"); |
|
84 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
85 | $this->assertTrue($doc->isExpired(), "Document is expired"); |
|
86 | SS_Datetime::clear_mock_now(); |
|
87 | ||
88 | $doc->expireAtDate(strtotime('-1 second')); |
|
89 | $this->assertTrue($doc->isHidden(), "Document is hidden"); |
|
90 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
91 | $this->assertTrue($doc->isExpired(), "Document is expired"); |
|
92 | ||
93 | $doc->clearExpiry(); |
|
94 | $this->assertFalse($doc->isHidden(), "Document is not hidden"); |
|
95 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
96 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
97 | } |
|
98 | ||
99 | public function testEmbargoUntilDate() |
|
100 | { |
|
@@ 99-134 (lines=36) @@ | ||
96 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
97 | } |
|
98 | ||
99 | public function testEmbargoUntilDate() |
|
100 | { |
|
101 | $doc = new DMSDocument(); |
|
102 | $doc->Filename = "DMS-test-lorum-file.pdf"; |
|
103 | $doc->Folder = "tests"; |
|
104 | $doc->write(); |
|
105 | ||
106 | $doc->embargoUntilDate(strtotime('+1 minute')); |
|
107 | $this->assertTrue($doc->isHidden(), "Document is hidden"); |
|
108 | $this->assertTrue($doc->isEmbargoed(), "Document is embargoed"); |
|
109 | ||
110 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
111 | ||
112 | $doc->embargoUntilDate(strtotime('-1 second')); |
|
113 | $this->assertFalse($doc->isHidden(), "Document is not hidden"); |
|
114 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
115 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
116 | ||
117 | $embargoTime = "2069-12-12 17:10:13"; |
|
118 | $doc->embargoUntilDate($embargoTime); |
|
119 | $this->assertTrue($doc->isHidden(), "Document is hidden"); |
|
120 | $this->assertTrue($doc->isEmbargoed(), "Document is embargoed"); |
|
121 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
122 | ||
123 | SS_Datetime::set_mock_now($embargoTime); |
|
124 | $this->assertFalse($doc->isHidden(), "Document is not hidden"); |
|
125 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
126 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
127 | ||
128 | SS_Datetime::clear_mock_now(); |
|
129 | ||
130 | $doc->clearEmbargo(); |
|
131 | $this->assertFalse($doc->isHidden(), "Document is not hidden"); |
|
132 | $this->assertFalse($doc->isEmbargoed(), "Document is not embargoed"); |
|
133 | $this->assertFalse($doc->isExpired(), "Document is not expired"); |
|
134 | } |
|
135 | ||
136 | public function testEmbargoUntilPublished() |
|
137 | { |